My problem is I want to watch for changes to a filtered array created with ng-repeat, for that I'm referencing to the parent scope since I've learned ng-repeat creates its own scope, and while watching the array with $scope.$watch actually works (it accurately detects changes to the array), I get multiple console log errors saying: angular.js:12520 RangeError: Maximum call stack size exceeded. Anyone have any inputs to what I can do to solve the problem?
HTML:
<div class="module-card" ng-repeat="module in ($parent.filteredModules = (modules | released : true | moduleFilter : allFilters | unique: 'name' | orderBy : sortFunc : orderedAsc | limitTo : limitResults)) track by $index">
JS:
$scope.$watch('filteredModules', function(newVal, oldVal){
console.log(newVal, oldVal);
}, true)
Solved the problem by using $scope.$watchCollection instead.. If anyone bumps into the same problem.