ng-view 'Maximum call stack size exceeded after' application start

39 views Asked by At

I am loading a page after the login process is complete. Basically login page having one ng-view, after login success I'm trying to load an entirely new page to replace the content.

$routeProvider
  .when('/', {
    templateUrl: 'views/login.html',
    controller: 'loginCtrl',
    controllerAs: 'login'
  })

  .when('/admin/customerview', {
    templateUrl: 'views/admin/customerview.html',
    controller: 'AdminCustomerviewCtrl',
    controllerAs: 'admin/customerview'
  })

});
<div class="container-fluid" >
    <ng-view></ng-view>
</div>
1

There are 1 answers

0
georgeawg On

Make the controllerAs property a simple identifier:

  .when('/admin/customerview', {
    templateUrl: 'views/admin/customerview.html',
    controller: 'AdminCustomerviewCtrl',
    ̶c̶o̶n̶t̶r̶o̶l̶l̶e̶r̶A̶s̶:̶ ̶'̶a̶d̶m̶i̶n̶/̶c̶u̶s̶t̶o̶m̶e̶r̶v̶i̶e̶w̶'̶
    controllerAs: '$ctrl'
  })

Using a slash (/) in the middle of a controllerAs identifier will cause problems when the AngularJS framework tries to compile the template. AngularJS will parse expressions with slash as a divide operator.