mirror of
https://github.com/jlengrand/polymer-array-bubble-up-example.git
synced 2026-03-10 08:41:23 +00:00
Working as expected, without index
This commit is contained in:
@@ -24,9 +24,10 @@
|
||||
notify: true
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_changeName: function(){
|
||||
this.fire('change-name', {"newPersonName" : "bobby","index":this.index });
|
||||
this.element.person.name = "bobby";
|
||||
this.fire('change-name', {});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -32,17 +32,16 @@
|
||||
},
|
||||
|
||||
attached: function(){
|
||||
this.addEventListener('change-name', function (e) {
|
||||
console.log("fired");
|
||||
|
||||
this.elements[e.detail.index].person.name = e.detail.newPersonName;
|
||||
|
||||
for(var i =0; i< this.elements.length; i++){
|
||||
this.notifyPath('elements.'+i+'.person.name');
|
||||
}
|
||||
this.addEventListener('change-name', function (e) {
|
||||
this._updateNames();
|
||||
console.log(this.elements);
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
_updateNames: function() {
|
||||
for(var i =0; i< this.elements.length; i++){
|
||||
this.notifyPath('elements.'+i+'.person');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user