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 c
Inside function use if condition to avoide continues for loop
scope.$watch('someVar', function(newValue, oldValue) { if(newValue!==oldValue) { console.log(newValue); scope.someVar = [Do something with someVar]; } });