无法实例化生产模块 [英] Unable to instantiate module on production
问题描述
未捕获的错误:[$ injector:modulerr]未能实例化模块diceAngularApp由于:
错误:[$ injector:unpr]未知的提供者:t
它在开发中工作得非常好,所以我不确定是什么问题可能是。要查看错误,请访问www.firexion.com/dice页面。
我不确定问题的确切位置,因此我不确定确切地分享哪些代码。以下是github的链接: https://github.com/Firexion/hundred
我的猜测是它可能在角度app.js也许?:
'严格使用';
.module('diceAngularApp',[
'ngCookies',
'ngResource',
'ngSanitize',
' ngRoute'
])
.config(函数($ routeProvider){
$ routeProvider
.when('/ dice',{
templateUrl:'../ ../views/dice/main.html',
控制器:'DiceController'
})
.otherwise({
redirectTo:'/ dice'
} );
});
或者我在我的rails应用程序中包含它错误的javascript文件,lumen.js:
// Lumen
// Bootswatch
// =需要jquery-2.1.0
// =需要jquery_ujs
// =需要流明/加载器
// =需要流明/靴子表
//角度
// =需要角度/角度
// =需要角度/角度曲奇
// =需要角度/角度资源
// =需要角度/角度路径
// =需要角度/角度消毒
// =需要角度/角度场景
//骰子
// =需要骰子/ app.js
// =需要骰子/ controllers / main.js
// =需要骰子/ dice.js
感谢您提供任何帮助, 。
我强烈的怀疑,基于Angular正在寻找变量t的提供者这一事实,我猜你不会命名服务/控制器/等。 t是你正在使用缩小/编译器的地方,它正在破坏你的变量。
为了解决这个问题并且在编译器中安全,你需要调整你的语法。详细信息请此处,但以下内容仅供参考。
myapp.config(['$ routeProvider',function($ routeProvider){
$ routeProvider.when('hello /:queryId',{
templateUrl:'mypartial.html',
控制器:MyCtrl,
controllerAs:'myCtrl',
解析:{
'myParam':['myService', '$ route',function(myService,$ route){
return myService.get($ route.current.params.queryId);
}]
}
});
I just pushed my program onto heroku and the page I had testing angular loaded with the following error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module diceAngularApp due to: Error: [$injector:unpr] Unknown provider: t
It was working perfectly fine in development so I'm not sure what the problem could be. To see the error you can visit the page at www.firexion.com/dice
I'm not sure exactly where the problem could be located so I'm not sure exactly which code to share. Here's the link to the github for it: https://github.com/Firexion/hundred
My guess is it could be in the angular app.js maybe?:
'use strict';
angular
.module('diceAngularApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
.config(function ($routeProvider) {
$routeProvider
.when('/dice', {
templateUrl: '../../views/dice/main.html',
controller: 'DiceController'
})
.otherwise({
redirectTo: '/dice'
});
});
or maybe I included it wrong in my rails application javascript file, lumen.js:
// Lumen
// Bootswatch
//= require jquery-2.1.0
//= require jquery_ujs
//= require lumen/loader
//= require lumen/bootswatch
// angular
//= require angular/angular
//= require angular/angular-cookies
//= require angular/angular-resource
//= require angular/angular-route
//= require angular/angular-sanitize
//= require angular/angular-scenario
// dice
//= require dice/app.js
//= require dice/controllers/main.js
//= require dice/dice.js
Thank you for whatever help you can provide.
My strong suspicion, based upon the fact that Angular is looking for a provider for the variable t and I am guessing you would not name a service/controller/etc. t is that you're using minification/compiler somewhere that is clobbering your variables.
To get around this and be safe with a compiler, you need to adjust your syntax. Full details here but the skinny is below.
myapp.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('hello/:queryId', {
templateUrl: 'mypartial.html',
controller: MyCtrl,
controllerAs: 'myCtrl',
resolve: {
'myParam': ['myService', '$route', function(myService, $route) {
return myService.get($route.current.params.queryId);
}]
}
});
这篇关于无法实例化生产模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!