0

i am getting the following error while routing the page using angular.js.

Error:

RangeError: Maximum call stack size exceeded
    at $ (http://oditek.in/Gofast/js/angularjs.js:73:115)
    at K (http://oditek.in/Gofast/js/angularjs.js:62:39)
    at h (http://oditek.in/Gofast/js/angularjs.js:54:410)
    at http://oditek.in/Gofast/js/angularjs.js:53:480
    at http://oditek.in/Gofast/js/angularjs.js:55:397
    at r (http://oditek.in/Gofast/js/angularjs.js:60:200)
    at x (http://oditek.in/Gofast/js/angularroute.js:6:364)
    at link (http://oditek.in/Gofast/js/angularroute.js:7:92)
    at $ (http://oditek.in/Gofast/js/angularjs.js:73:89)
    at K (http://oditek.in/Gofast/js/angularjs.js:62:39) <!-- ngView:  -->

I am explaining my code below.

index.html:

<!DOCTYPE html>
<html lang="en" ng-app="Channabasavashwara">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>...:::WELCOME TO Channabasavashwara Institude of Technology:::...</title>

    <!-- PACE LOAD BAR PLUGIN - This creates the subtle load bar effect at the top of the page. -->
    <link href="css/pace.css" rel="stylesheet">
    <script src="js/pace.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="js/angularjs.js" type="text/javascript"></script>
    <script src="js/angularroute.js" type="text/javascript"></script>
    <script src="controller/loginRoute.js" type="text/javascript"></script>
    <!-- GLOBAL STYLES - Include these on every page. -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic' rel="stylesheet" type="text/css">
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel="stylesheet" type="text/css">
    <link href="icons/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link rel="shortcut icon" href="img/favicon.png">
    <!-- PAGE LEVEL PLUGIN STYLES -->
    <!-- THEME STYLES - Include these on every page. -->
    <link href="css/style.css" rel="stylesheet">
    <link href="css/plugins.css" rel="stylesheet">
    <link href="css/chosen.css" rel="stylesheet">

    <!-- THEME DEMO STYLES - Use these styles for reference if needed. Otherwise they can be deleted. -->
    <link href="css/demo.css" rel="stylesheet">
    <!-- PAGE LEVEL PLUGIN STYLES -->
    <!-- THEME STYLES - Include these on every page. -->
    <link href="css/load.css" rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <!-- THEME DEMO STYLES - Use these styles for reference if needed. Otherwise they can be deleted. -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div ng-view>
</div>
    <!-- GLOBAL SCRIPTS -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.slimscroll.min.js"></script>
    <script src="js/jquery.popupoverlay.js"></script>
    <script src="js/defaults.js"></script>
    <!-- Logout Notification Box -->

    <!-- /#logout -->
    <!-- Logout Notification jQuery -->
    <script src="js/logout.js"></script>
    <!-- HISRC Retina Images -->

    <!-- THEME SCRIPTS -->
    <script src="js/flex.js"></script>
    <script src="js/dashboard-demo.js"></script>
    <script src="js/chosen.jquery.js" type="text/javascript"></script>
    <script src="js/prism.js" type="text/javascript"></script>
    <script src="js/shortcut.js"></script>
    <!-- HISRC Retina Images -->

    <!-- THEME SCRIPTS -->
    <link rel="stylesheet" type="text/css" href="calendar/tcal.css" />
    <script type="text/javascript" src="calendar/tcal.js"></script> 
    <script src="js/newbill.js"></script>
    <script src="controller/loginController.js" type="text/javascript"></script>
    <script src="controller/dashboardController.js" type="text/javascript"></script>
</body>
</html>

Here i have a login page first going to bind.When user will logged in successfully the dashboard page should display but its throwing the above error.

loginRoute.js:

var Admin=angular.module('Channabasavashwara',['ngRoute']);
Admin.config(function($routeProvider){
    $routeProvider
    .when('/',{
        templateUrl: 'dashboardview/login.html',
        controller: 'loginController'
    })
    .when('/dashboard',{
        templateUrl: 'dashboardview/dashboard.html',
        controller: 'dashboardController'
    });
})

loginController.js:

var loginAdmin=angular.module('Channabasavashwara');
loginAdmin.controller('loginController',function($scope,$http){
    $scope.user_name = ''; 
    $scope.user_pass = '';
    $scope.user_login=function(){
    if($scope.user_name==''){
        alert('user name filed should not keep blank');
    }else if($scope.user_pass==''){
        alert('password filed should not keep blank');
    }else{
        var userData={'user_name':$scope.user_name,'user_pass':$scope.user_pass};
        console.log('user',userData);
        $http({
            method: 'POST',
            url: "php/Login/login.php",
            data: userData,
            headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        }).then(function successCallback(response){
            console.log('response',response);
            alert(response.data['msg']);
            location.href='#dashboard';
        },function errorCallback(response) {
            alert(response.data['msg']);
        });
    }
    }
});

Here i am getting the login page first.After finishing the successfully login it should redirect to dashboard page but this error is coming.Please help me to resolve this error.

1 Answer 1

1

Add $location in your controller. loginAdmin.controller('loginController',function($scope,$http, $location){

and replace location.href='#dashboard'; with $location.path('/dashboard');

Sign up to request clarification or add additional context in comments.

7 Comments

@ Sarjan : I changed but still the error is coming.
Do you have proper location for all html and other file based on template URL?
@ Sarjan : I found one issue the dashboardController.js file is calling repetedly in a loop i think this may the reason.
@ Sarjan : yes, when i am writing only hello in partial html(i.e-dashboard.html) file its coming properly.
i said the controller file is calling again and again in a loop.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.