polymer - Call Method of Child Web Component -
i'm having difficulty trying figure out how call function of nested polymer web component.
here's markup:
<rise-playlist> <rise-playlist-item duration="5"> <rise-distribution distribution='[{"id":"vgzuddwyazhy"}]'></rise-distribution> </rise-playlist-item> </rise-playlist> the rise-distribution component has canplay function call inside of rise-playlist.
the dom-module definition of rise-playlist looks this:
<dom-module id="rise-playlist"> <template> <content id="items" select="rise-playlist-item"></content> </template> </dom-module> i can access rise-distribution element this:
var distribution = polymer.dom(this.$.items[0]).queryselector("rise-distribution"); however, when try call distribution.canplay(), says distribution.canplay not function.
i've defined dom-module of rise-playlist-item this:
<dom-module id="rise-playlist-item"> <content id="dist" select="rise-distribution"></content> </dom-module> not sure if need <content> tag, although neither works.
any ideas?
thx.
i know there have been while sure problems still occurs being viewed number of times.
probably there problem component definition. let me explain. way put child component inside dom:
<your-child-component></your-child-component> and , should definition of component:
polymer({ is: 'your-child-component', apimethod: function() { //some stuff } }); if mistake or due copy-paste error mistype is: 'your-child-component' part, not reflect <your-child-component> confused becouse your:
this.$$('your-child-component').apimethod(); will tell there no method willing call.
polymer correctly identified , selected dom <your-child-component> if have different is property (like example is: your_child_component>) not attach api dom element selected.
i hope if ever encounter problem.
Comments
Post a Comment