[英]Angular error : Uncaught Error: [$injector:modulerr] Failed to instantiate module
I keep getting this error when trying to run my app :尝试运行我的应用程序时,我不断收到此错误:
bundle.js:188 Uncaught Error: [$injector:modulerr] Failed to instantiate
module app due to:
TypeError: Cannot read property 'setKey' of undefined
Here is my app.js file这是我的 app.js 文件
require('angular')
require('angular-route')
var app = angular.module('app',['ngRoute'])
require('./services/car_service')(app);
require('./services/auth_service')(app);
require('./services/error_service')(app);
require('./controllers/car-controller.js')(app)
require('./controllers/user-controller.js')(app)
app.config(['$routeProvider', function(router, filepickerProvider) {
router
.when('/', {
templateUrl: 'templates/home.html'
})
.when('/login', {
controller: 'UserController',
controllerAs: 'userctrl',
templateUrl: 'templates/login.html'
})
.when('/submit', {
templateUrl: 'templates/submit.html'
})
.when('/inventory', {
templateUrl: 'templates/inventory.html'
})
.when('/new-admin', {
templateUrl: 'templates/new-admin.html'
})
.when('/admin-view', {
templateUrl: 'templates/admin-view.html'
})
filepickerProvider.setKey(FILEPICKER);
}])
I am not sure what I am missing but any advice or suggestions would be great.我不确定我错过了什么,但任何建议或建议都会很棒。
It seens that you are missing the injection of the file picker in your app module.它看到您在应用程序模块中缺少文件选择器的注入。
That is causing your filepickerProvider to be null.这导致您的 filepickerProvider 为空。
try to do the follow:尝试执行以下操作:
`var app = angular.module('app',['ngRoute', 'angular-filepicker'])
Hope it helps!希望有帮助!
对于像我这样的菜鸟,请确保文件的所有路径都是正确的,尤其是您的 js 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.