I have an Ember Object and its Instantiation, on calling the "updateName" method periodically the property value updates, but is NOT reflected in the template via "model". Any guesses on what am I doing wrong?
var App = Ember.Application.create();
App.Router.map(function(){
this.route('application');
});
App.myData = Ember.Object.extend({
name: 'luke',
updateName: function(){
this.set('name', Math.random(1,10)+'');
},
newName: function(){
return this.get('name');
}.property('name')
});
App.myDataObj = App.myData.create({});
setInterval( function(){
App.myDataObj.updateName()
console.log( App.myDataObj.get('newName') )
}, 5000 );
App.ApplicationRoute = Ember.Route.extend({
model: function(){
return {
name: App.myDataObj.get('newName')
};
}
});
Output: Luke and thats it
Help Appreciated