diff --git a/app/components/another-component/another-component.html b/app/components/another-component/another-component.html index 15f4c30..c6086f3 100644 --- a/app/components/another-component/another-component.html +++ b/app/components/another-component/another-component.html @@ -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', {}); } }); diff --git a/app/components/example-component/example-component.html b/app/components/example-component/example-component.html index e905275..a069e71 100644 --- a/app/components/example-component/example-component.html +++ b/app/components/example-component/example-component.html @@ -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'); + } } });