Working as expected, without index

This commit is contained in:
Julien Lengrand-Lambert
2017-08-17 08:34:37 +02:00
parent 57b7207fbd
commit 7579aedc8c
2 changed files with 11 additions and 11 deletions

View File

@@ -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>

View File

@@ -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');
}
}
});