也许有人知道如何解决这个问题:
angular.module('myApp')
.component('myComponent', {
controller: function () {
this.prop1 = 1;
},
templateUrl: 'template.html'
}
所以 $watch() 没有为新版本启用。$onChanges() - 不起作用,因为这是内部属性。可以有人解决这个问题吗?谢谢你的帮助。
也许有人知道如何解决这个问题:
angular.module('myApp')
.component('myComponent', {
controller: function () {
this.prop1 = 1;
},
templateUrl: 'template.html'
}
所以 $watch() 没有为新版本启用。$onChanges() - 不起作用,因为这是内部属性。可以有人解决这个问题吗?谢谢你的帮助。
尝试这个
angular.module('app.components', [])
.component('changeHandler', {
controller: function ChangeHandlerController() {
$onChanges: function (changes) {
if (changes.canChange)
this.performActionWithValueOf(changes.canChange);
};
},
bindings: {
canChange: '<'
},
templateUrl: 'change-handler.html'
});