polymer 2.x - How to access child element in parent element -


i creating element in parent element having button. on tap of button properties of child element changing. following code snippet-

<parent-element>      <template is="dom-repeat" items="{{aa}}">     <child-element id="aa{{index}}">     <button on-tap="_clickfunction">     </template>  _clickfunction(){             for(var = 0; < items.length; i++){                           this.shadowroot.queryselector("aa" + i).prop1 = true;                this.shadowroot.queryselector("aa" + i).prop2 = true;             } } </parent-element>   <child-element>     properties:{         prop1: boolean,         prop2: boolean, } </child-element> 

how possible without using id or dom-manipulation. if there dom-repeat, how access properties of particular child element.

try this:

_clickfunction(e){     let childitemindex = e.model.index;     var childitem = this.shadowroot.getelementbyid(`aa${childitemindex}`);     item.prop1 = !!1;     item.prop2 = !!1; } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -