且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Angular 模块注入错误

更新时间:2023-11-22 17:40:04

$routeParams 应该使用 Provider 进行后期修复,因为您只能在配置阶段使用提供程序.

$routeParams should be post fix with Provider as you can only use provider in config phase.

此外,您应该始终只定义一次应用程序,然后使用该模块将其附加,重新创建 angular.module 将刷新旧应用程序 &新副本将被视为该模块.在您服务&您需要将控制器从 angular.module('angularTest',[]) 更改为 angular.module('angularTest')

Also you should always define app only once then append it by using that module, recreating angular.module will flush the old app & new copy will treated as that module. In you service & controller you need to make change from angular.module('angularTest',[]) to angular.module('angularTest')

此外,您错过了在 LogInController

  .when('/login?returnUrl', {
     templateUrl: '/Account/Login',
     controller: 'LoginController' //<--here added qoutes
  });

最后一件事,您错过了添加 AuthHttpResponseInterceptor.js ,它无法被 angular 应用识别,并且抛出了未定义的 AuthHttpResponseInterceptor 工厂.

One last thing, you missed to add AuthHttpResponseInterceptor.js which was not recognize by the angular app and was throwing AuthHttpResponseInterceptor factory not defined.

工作 Plunkr