v1.2.0
Added support for bindWatchToClass
option
When you use the controllerAs syntax this allows you to set up a watcher that will bind to the class rather than the scope. This means you don't need to hardcode the controller name to your watch key.
Keywords ({object}
, {collection}
etc..) and expressions also work just like they did before.
// before 1.2
app.classy.controller({
__options: {
addToScope: false
},
watch: {
'todoCtrl.location.path()': function(newVal) { },
'{object}todoCtrl.todos': function(newVal) { },
}
});
// 1.2
app.classy.controller({
__options: {
addToScope: false,
bindWatchToClass: true
},
watch: {
'location.path()': function(newVal) { },
'{object}todos': function(newVal) { },
}
});
Remember you can also set options on a per-module basis (instead of per-controller). For example, to set options on the app
module:
app.classy.options.controller = {
addToScope: false,
bindWatchToClass: true
};
For more info and discussion see issue #49.