I've this code (http://jsfiddle.net/stephane_klein/gyHmS/2/) :
App = Ember.Application.create({});
App.Item = Ember.Object.extend({
title: null,
parent: null
});
App.MyList = Ember.Object.extend({
title: null,
content: [],
changed: function() {
console.log('here');
}.observes('content')
});
App.list = App.MyList.create({
title: "foobar",
content: [
App.Item.create({
item: "item1"
}),
App.Item.create({
item: "item2"
})
]
});
console.log(App.list.content);
App.list.content.pushObject(
App.Item.create({
item: "item3"
})
);
console.log(App.list.content);
Why "console.log('here')" is never called ?
I want set App.Item.parent when App.Item is inserted in App.MyList. I don't know how to observe App.MyList.content field.
Thanks for your help.
Best regards, Stephane