I want to store a date string in $rootScope but as soon as I do it throws infinite digestion errors.
$rootScope.lastWeek = '2015-12-03';
$rootScope.yesterday = '2015-12-09';
Why can't I do that?
EDIT:
.run(function ($window, $rootScope, $state, LoginService) {
$rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
$rootScope.user = angular.fromJson($window.sessionStorage.user);
$rootScope.loggedIn = $window.sessionStorage.loggedIn;
// Calendar options and attributes Datepicker date format
$rootScope.lastWeek = '2015-12-03';
$rootScope.yesterday = '2015-12-09';
});
});
Problem
I was using $rootScope.lastWeek in the view for a datepicker which had a $watch triggering a infinite digestion error. I just made a $scope variable equal my rootscope variable and using that in the view instead.