ng-view'在应用程序启动后超出了最大调用堆栈的大小

问题描述 投票:0回答:1

我在登录过程完成后正在加载页面。基本上登录页面具有一个ng视图,登录成功后,我试图加载一个全新的页面来替换内容。

$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>
angularjs angularjs-routing
1个回答
0
投票

使controllerAs属性成为一个简单的标识符:

  .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'
  })

/标识符中间使用斜杠(controllerAs)将在AngularJS框架尝试编译模板时引起问题。 AngularJS将使用斜杠作为除法运算符来解析表达式。

© www.soinside.com 2019 - 2024. All rights reserved.