Angular 1.6.4 如何检测组件无绑定属性的变化

Angular 1.6.4 How to detect changes in no-bindings properties of components

也许有人知道如何解决这个问题:

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'
});