forked from vehikl/polymer-select-with-options
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
109 lines (105 loc) · 3.26 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>select-with-options demo</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.21/webcomponents.min.js"></script>
<link rel="import" href="polymer.html">
<link rel="import" href="select-with-options.html">
<dom-module id="demo-1">
<template>
<div>
<select is="select-with-options" options-list="{{options}}" value="{{value::change}}">
</select>
<span>{{value}}</span>
</div>
</template>
</dom-module>
<script>
window.addEventListener('WebComponentsReady', function(e) {
new Polymer({
is: 'demo-1',
properties: {
value : {
type: String
},
options: {
value: [
'one',
'two',
'three'
]
}
}
});
});
</script>
<dom-module id="demo-2">
<template>
<div>
<select is="select-with-options" options-list="{{options}}" option-value="id" option-label="name" value="{{value::change}}">
</select>
<span>{{value}}</span>
</div>
</template>
</dom-module>
<script>
window.addEventListener('WebComponentsReady', function(e) {
new Polymer({
is: 'demo-2',
properties: {
value : {
type: String,
value: 2
},
options: {
value: [
{id: 1, name: 'One'},
{id: 2, name: 'Two'},
{id: 3, name: 'Three'}
]
}
}
});
});
</script>
<dom-module id="demo-3">
<template>
<div>
<select is="select-with-options" options-list="{{options}}" option-value="id" option-label="name" value="{{value::change}}">
<option value="hardcoded_option">Hardcoded Option</option>
</select>
<span>{{value}}</span>
</div>
</template>
</dom-module>
<script>
window.addEventListener('WebComponentsReady', function(e) {
new Polymer({
is: 'demo-3',
properties: {
value : {
type: String,
value: 2
},
options: {
value: [
{id: 1, name: 'One'},
{id: 2, name: 'Two'},
{id: 3, name: 'Three'}
]
}
}
});
});
</script>
<div>Demo with array of String</div>
<demo-1></demo-1>
<div>Demo with array of Object</div>
<demo-2></demo-2>
<div>Demo with hardcoded options</div>
<demo-3></demo-3>
</body>
</html>