polymer - Template repeat inside template repeat - get all item names -
i'm trying realise website using polymer 1.0. have custom element my-greeting template repeats inside.
what do, , don't find how this, string called target looks :
/constantpath/folder1/aaa.jpg /constantpath/folder1/bbb.jpg /constantpath/folder2/aaa.jpg /constantpath/folder2/bbb.jpg
so general string : /constantpath/{{repeat1.id}}/{{repeat2.id}}.jpg
how can ??
here code :
<dom-module id="my-greeting"> <template> <template is="dom-repeat" items="{{repeat1}}"> <template is="dom-repeat" items="{{repeat2}}"> target : <iron-image src="target"></iron-image> </template> </template> </template> <script> polymer({ is: 'my-greeting', ready: function() { this.repeat1 = [ {id: 'folder1'}, {id: 'folder2'} ]; this.repeat2 = [ {id: 'aaa'}, {id: 'bbb'} ]; } } ); </script>
thanks.
here go:
<dom-module id="my-greeting"> <template> <template is="dom-repeat" items="{{repeat1}}" as="folderone"> <template is="dom-repeat" items="{{repeat2}}" as="foldertwo"> target : <span>{{gettarget(folderone, foldertwo)}}</span></br> </template> </template> </template> <script> polymer({ is: 'my-greeting', ready: function() { this.repeat1 = [ {id: 'folder1'}, {id: 'folder2'} ]; this.repeat2 = [ {id: 'aaa'}, {id: 'bbb'} ]; }, gettarget: function(folderone, foldertwo){ return "/constantpath/"+folderone.id+"/"+foldertwo.id; }, } ); </script> </dom-module>
Comments
Post a Comment