Hi everyone, 
I'm trying to use the scope.$watch function *within a loop* and I cannot 
make it work as expected.


The code is something like this

for(var i in control.children) {
  scope.$watch(
      control.children[i].propertyId,
      function(newValue, oldValue) {
        if ( newValue !== oldValue ) {
          // do something
        }
      }
  );
}


As you can see the first parameter of scope.$watch depends by the current 
loop index.

When edit *any* of the watched model the watcher that run is always the 
latest registered 
by the loop.


The question is, it is possible to use watchers within a loop?

Thanks




-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to