Closed
Description
I want to generate the observe block in the created or ready callback. However, the handlers don't seem to get called.
Here's the code:
created: function () {
var viewData = {
type: 'Pikachu',
name: 'Gary'
};
// iterate over view data
for (prop in viewData) {
//set the property
this[prop] = viewData[prop];
var handlerName = 'update' + prop
// set add the property to the observe block
this.observe[prop] = handlerName;
// set the handler
this[handlerName] = function (valueWas, valueIs) {
console.log('you have changed ' + prop + ' to ' valueIs);
};
}
},
Metadata
Assignees
Labels
No labels