Angularjs: 'controller as syntax' and $watch

前端 未结 10 1596
抹茶落季
抹茶落季 2020-11-28 18:52

How to subscribe on property change when using controller as syntax?

controller(\'TestCtrl\', function ($         


        
10条回答
  •  误落风尘
    2020-11-28 19:57

    You can use:

       $scope.$watch("test.name",function(value){
            console.log(value)
       });
    

    This is working JSFiddle with your example.

提交回复
热议问题