我有一些代码,此时,我只是想按照UI路由器页面的“入门”部分来了解当前应用程序的内容。
(function () {
var app = angular.module('configurator.boot', ['configurator.errorhandler', 'configurator.routes', 'ui.router']);
app.config(function ($stateProvider, $urlRouterProvider) {
console.log($stateProvider);
});
app.run(function () { });
})();
加载页面时出现此错误:
Failed to instantiate module configurator.boot due to:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.28/$injector/unpr?p0=a
at Error (native)
at http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:6:450
at http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:36:202
at c (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:34:305)
at Object.d [as invoke] (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:35:6)
at http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:33:394
at r (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:7:290)
at e (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:33:207)
at ec (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:36:309)
at c (http://wkslt-139998:96/configurator/scripts/lib/angular.min.js:18:170
如果我只是记录'hello',那就行了,这样我就会认为我需要为模块函数添加一些其他依赖,但我不知道是什么。
感谢您提供给我的任何帮助,我刚刚开始研磨我的车轮一天。
答案 0 :(得分:0)
这是缩小过程。将其更改为:
(function () {
var app = angular.module('configurator.boot', ['configurator.errorhandler', 'configurator.routes', 'ui.router'])
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
console.log($stateProvider);
}]);
app.run(function () { });
})();
修好了。