In AngularJS I have a directive that watches a scope variable. When the variable contains certain data then I need to alter that variable a bit. The problem is that when I change the variable that my $watch is triggered again. So I end up in a continuous loop.
scope.$watch('someVar', function(newValue, oldValue) { console.log(newValue); scope.someVar = [Do something with someVar]; }); This keeps triggering $watch again, which makes sense. But I do need a way to change the watched variable. Is there a way to do this?