Skip to content Skip to sidebar Skip to footer

Rangeerror: Maximum Call Stack Size Exceeded (angularjs)

I am trying to develop a web application using AngularJS. I am not able to route the web pages using ngRoute. I have written web server in Bottle python framework, which throws no

Solution 1:

This error usually occurs when there is a route loop created at the below code

app.run(function ($rootScope,$location,AUTH_EVENTS,$cookieStore,$http,$q,$timeout) {
$rootScope.flag = false;
$rootScope.$on('$routeChangeStart', function(evt, absNewUrl, absOldUrl) {
    $cookieStore.get(AUTH_EVENTS);
    if($rootScope.AUTH_EVENTS != AUTH_EVENTS.loginSuccess && !$cookieStore.get(AUTH_EVENTS)){    
        //console.log($rootScope.AUTH_EVENTS);$location.path('/');
        //$route.reload();
    }
    if(absNewUrl.$$route.originalPath == '/dashboard' && $rootScope.flag == false){
        $rootScope.flag = true;
    }
        //here you can check for your own condition and if not logged in then set $location.path(loginpath);
  });
});

You might be redirecting to a route from loginfactory and due to some condition it is being processed again and again at $routeChangeStart event

Post a Comment for "Rangeerror: Maximum Call Stack Size Exceeded (angularjs)"