0

Maybe someone know how to solve that problem:

angular.module('myApp')
.component('myComponent', {
    controller: function () {
        this.prop1 = 1;
    },
    templateUrl: 'template.html'
}

So $watch() is not enable for new version. $onChanges() - not work because this is inner property. Can have someone solution to resolve this problem? Thank's for your help.

Mistalis
  • 17,793
  • 13
  • 73
  • 97
Sergaros
  • 821
  • 1
  • 5
  • 14

1 Answers1

1

try this

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'
});
Mistalis
  • 17,793
  • 13
  • 73
  • 97
Always Learn
  • 662
  • 6
  • 14