-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplating-demo.html
51 lines (46 loc) · 1.58 KB
/
templating-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
<link rel="import" href="../polymer/polymer-element.html">
<dom-module id="templating-demo">
<script>
/**
* `templating-demo`
* Test examples
*
* @customElement
* @polymer
* @demo demo/templating-demo.html
*/
class TemplatingDemo extends Polymer.Element {
static get is() { return 'templating-demo'; }
static get properties() {
return {
hiddenProperty: Boolean,
showProperty: Boolean,
products: Array,
};
}
static get template() {
return Polymer.html`
<style>
:host {
display: block;
}
</style>
<template is="dom-if" if="[[!hiddenProperty]]">
<p id="noHiddenParagraph">You can see me because !hiddenProperty is [[!hiddenProperty]]</p>
</template>
<template is="dom-if" if="[[showProperty]]">
<p id="showParagraph">You can see me because showProperty is [[showProperty]]</p>
</template>
<template is="dom-if" if="[[products]]">
<ul id="products">
<template is="dom-repeat" items="[[products]]" as="product">
<li>[[product.id]] -> [[product.name]]</li>
</template>
</ul>
</template>
`;
}
}
window.customElements.define(TemplatingDemo.is, TemplatingDemo);
</script>
</dom-module>