diff --git a/app/components/another-component/another-component.html b/app/components/another-component/another-component.html index 4b123a9..15f4c30 100644 --- a/app/components/another-component/another-component.html +++ b/app/components/another-component/another-component.html @@ -26,13 +26,7 @@ }, _changeName: function(){ - console.log("changing name"); - // this.dispatchEvent(new CustomEvent('kick', {detail: {kicked: true}})); - this.fire('kick', {kicked: true}); - this.set('element.person', {"name": "bobby"}); - this.notifyPath('element'); - this.notifyPath('element.person'); - this.notifyPath('elements'); + this.fire('change-name', {"newPersonName" : "bobby","index":this.index }); } }); diff --git a/app/components/example-component/example-component.html b/app/components/example-component/example-component.html index ef888c7..e905275 100644 --- a/app/components/example-component/example-component.html +++ b/app/components/example-component/example-component.html @@ -13,7 +13,7 @@

List of elements

@@ -29,7 +29,22 @@ value: [{"name": "Main1", "person": fred}, {"name": "Main2", "person": tom}, {"name": "Main3", "person": fred}], notify: true } + }, + + 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'); + } + console.log(this.elements); + + }); } + }); \ No newline at end of file diff --git a/app/index.html b/app/index.html index f6d4cd2..9d9b005 100644 --- a/app/index.html +++ b/app/index.html @@ -10,28 +10,5 @@ - - \ No newline at end of file