Wednesday, 21 August 2013

Angular $scope.$watch on (for in... ) don't work

Angular $scope.$watch on (for in... ) don't work

in my code i have the following for watch changes in some variables
$scope.$watch('ns.namespace.watchable_value', function(newVal, oldVal){
//...
})
now i have many namespaces with a watchable_value and I wanna do
for (namespace in [...]) {
$scope.$watch('ns.' + namespace + '.watchable_value', function(newVal,
oldVal){
//...
})
}
but the callback never is called

No comments:

Post a Comment