Angularjs。错误:$ controller:ctrlreg未注册具有此名称的控制器

时间:2017-10-29 11:59:03

标签: angularjs

我在Chrome控制台上收到以下错误:

名称为“registerCtrl”的控制器未注册。

由于某种原因,当路由到根或/ register时,我的registerCtrl没有被识别。

由于某种原因,当路由到根或/ register时,我的registerCtrl没有被识别。

的index.html

export { resolvers }

app.js(自举)

export let resolvers = {};

resolvers.value1= 'value';
resolvers.value2= 'value';

registerCtrl

<html ng-app="testApp">
 <head>
  <base href="/">
  <title></title>
  <link href="Content/bootstrap.css" rel="stylesheet" />
  <script src="Scripts/jquery-3.2.1.min.js"></script>
  <script src="Scripts/angular.min.js"></script>
  <script src="Scripts/angular-route.min.js"></script>
  <script src="app/app.js"></script>
  <script src="app/register/registerCtrl.js"></script>
  <script src="app/adminDashBoard/adminDashBoardCtrl.js"></script>
  <script src="app/services/hubProxy.js"></script>
  <script src="Scripts/bootstrap.min.js"></script>
  <script src="app/directives/alerts/alertDir.js"></script>
 </head>
 <body>
   <div ng-view></div>
 </body>
</html>

register.Html

(function () {
     var app = angular.module('testApp', ["ngRoute"]);

 app.config(function ($routeProvider, $locationProvider) {
    $routeProvider
     .when("/", {
            templateUrl: "/app/register/register.html",
            controller: 'registerCtrl'
     })
    .when("/register", {
        templateUrl: "/app/register/register.html",
        controller: 'registerCtrl'
    })
    .when("/adminDashBoard", {
            templateUrl: "/app/adminDashBoard/adminDashBoard.html",
            controller:'adminDashboardCtrl'
    })
});
})();

有什么想法吗?感谢

0 个答案:

没有答案