Polymer 1.0 notifyPath for array element -
simple example:
<template is="dom-repeat" items="{{items}}"> <template is="dom-repeat" items="{{item.subitems}}"> <span>{{item}}</span> </template> <span on-tap="add">add</span> </template> attached: function () { this.items = [ { subitems:[] }, { subitems:[] } ] }, add: function (e) { e.model.item.subitems.push("test"); }
this not refresh dom-repeat {{item.subitems}}. how can notify polymer of change?
from docs
mutations items array (push, pop, splice, shift, unshift) must performed using methods provided on polymer elements, such changes observable elements bound same array in tree. example:
this.push('employees', { first: 'jack', last: 'aubrey' });
Comments
Post a Comment