app.controller('indexController', ['$scope', '$location', 'authService', function ($scope, $location, authService) {
var vm = this;
vm.$onInit = function () {
vm.active = {
"home": true,
"welcome": false,
"user": false,
"logout": false,
"login": false,
"signup":false
};
};
$scope.$watch('vm.active', function (newObj, oldObj) {
Object.keys(newObj).filter(function (key) {
vm.active[key] = newObj[key] !== oldObj[key];
return vm.active[key];
});
}, true);
}]);
My intention is to modify the property of the vm.active
object, but I encountered the following error:
angular.js:14642 Error: [$rootScope:infdig]http://errors.angularjs.org/1.6.5/$rootScope/.. at angular.js:88 at m.$digest (angular.js:18248) at b.$apply (angular.js:18480) at HTMLAnchorElement. (angular.js:27290) at HTMLAnchorElement.dispatch (jquery-3.1.1.js:5201) at HTMLAnchorElement.elemData.handle (jquery-3.1.1.js:5009)