I had another problem. Consider the following:
app.controller('MainCtrl', function($scope) {
unwatch = $scope.$watch('variableName', function() {
[...];
},true);
setInterval(function() {
$scope.variable++;
$scope.$apply();
}, 1000);
});
and I had a different controller
app.controller('RelatedCtrl', function($scope) {
unwatch = $scope.$watch('totallyUnrelated', function() {
[...];
},true);
});
the problem was that the assignment is the unwatch = [...];same aswindow.unwatch = [...];
, , ...
var unwatch = [...];, ( js, angular).
.
app.controller('MainCtrl', function($scope) {
var unwatch = $scope.$watch('variableName', function() {
[...];
},true);
setInterval(function() {
$scope.variable++;
$scope.$apply();
}, 1000);
});