File tree 1 file changed +87
-0
lines changed
1 file changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > polymer</ title >
5
+
6
+ < script src ="//polygit.org/components/webcomponentsjs/webcomponents-lite.js "> </ script >
7
+ < link href ="//polygit.org/components/polymer/polymer.html " rel ="import ">
8
+
9
+ </ head >
10
+ < body >
11
+
12
+ < dom-module id ="x-templatizer ">
13
+ < template >
14
+ < button on-tap ="addContent "> Add content</ button >
15
+ < div id ="templates ">
16
+ < content > </ content >
17
+ </ div >
18
+ </ template >
19
+ </ dom-module >
20
+
21
+ < dom-module id ="x-elem ">
22
+ < template >
23
+ < h3 > x-templatize 1</ h3 >
24
+ < x-templatizer >
25
+ < template >
26
+ < div >
27
+ templatizer 1 _hasActions=< span > {{_hasActions}}</ span >
28
+ </ div >
29
+ </ template >
30
+ </ x-templatizer >
31
+ < h3 > x-templatizer 2</ h3 >
32
+ < x-templatizer >
33
+ < template >
34
+ < div >
35
+ templatizer 2 _hasActions=< span > {{_hasActions}}</ span >
36
+ </ div >
37
+ </ template >
38
+ </ x-templatizer >
39
+ </ template >
40
+ </ dom-module >
41
+
42
+ < script >
43
+ /*global HTMLImports,Polymer */
44
+ HTMLImports . whenReady ( function ( ) {
45
+ Polymer ( {
46
+ is : 'x-templatizer' ,
47
+ behaviors : [
48
+ Polymer . Templatizer
49
+ ] ,
50
+ _ensureTemplatized : function ( ) {
51
+ if ( ! this . ctor ) {
52
+ this . _template = Polymer . dom ( this ) . querySelector ( 'template' ) ;
53
+ this . templatize ( this . _template ) ;
54
+ }
55
+ } ,
56
+ addContent : function ( ) {
57
+ this . _ensureTemplatized ( ) ;
58
+
59
+ var instance = this . stamp ( { } ) ;
60
+
61
+ Polymer . dom ( this ) . appendChild ( instance . root ) ;
62
+ } ,
63
+
64
+ _forwardParentProp : function ( prop , value ) {
65
+ console . log ( 'implement forwarding prop to template instances' , prop , value ) ;
66
+ }
67
+
68
+ } ) ;
69
+
70
+ Polymer ( {
71
+ is : 'x-elem' ,
72
+ properties : {
73
+ _hasActions : {
74
+ type : Number ,
75
+ notify : true ,
76
+ value : 0
77
+ }
78
+ }
79
+ } ) ;
80
+ } ) ;
81
+ </ script >
82
+
83
+ < x-elem > </ x-elem >
84
+
85
+
86
+ </ body >
87
+ </ html >
You can’t perform that action at this time.
0 commit comments