How to watch component binding change using Angular component

前端 未结 5 2052
醉梦人生
醉梦人生 2020-12-14 15:04

How can I listen to angular component binding change and perform actions?

angular.module(\'myapp\')
    .component(\'myComponent\', {
        templateUrl: \'         


        
5条回答
  •  半阙折子戏
    2020-12-14 15:25

    Currently you can't use angular watchers without $scope as change detection is based around $scope. Even if you use expressions in HTML it would delegate watch functionality to $scope.

    Even if you create some other mechanism to watch you will need to remember to unwatch manually - and with $scope it's done automatically.

提交回复
热议问题