How to $watch changes on models created by ng-repeat?

后端 未结 6 1973
感动是毒
感动是毒 2020-12-08 00:53

Consider this Plnkr for example. I don\'t know how many members of fooCollection will be created beforehand. So I don\'t know how many bar models a

6条回答
  •  抹茶落季
    2020-12-08 01:23

    You can pass true as third argument into $watch

    $scope.$watch('something', function() { doSomething(); }, true);
    

    https://docs.angularjs.org/api/ng/type/$rootScope.Scope

提交回复
热议问题