admin管理员组文章数量:1312702
I'm trying to add angular-translate to my angular app. I followed this simple quick start: , but my app won't bootstrap, giving me the following error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr] Failed to instantiate module pascalprecht.translate due to: Error: [$injector:nomod] Module 'pascalprecht.translate' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
My index.html file is properly including angular-translate like so:
<script src="bower_ponents/angular-translate/angular-translate.js"></script>
Any clue why this could be happening?. I'd really appreciate the help.
UPDATE
Here's part of my app.js to clarify things a bit:
var app = angular.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
// 3rd party modules.
'ui.router',
'restangular',
'angular.filter',
'ui.bootstrap',
'pascalprecht.translate',
// Custom modules.
'myApp.config'
])
.
.
.
I'm trying to add angular-translate to my angular app. I followed this simple quick start: https://angular-translate.github.io/docs/#/guide, but my app won't bootstrap, giving me the following error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr] Failed to instantiate module pascalprecht.translate due to: Error: [$injector:nomod] Module 'pascalprecht.translate' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
My index.html file is properly including angular-translate like so:
<script src="bower_ponents/angular-translate/angular-translate.js"></script>
Any clue why this could be happening?. I'd really appreciate the help.
UPDATE
Here's part of my app.js to clarify things a bit:
var app = angular.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
// 3rd party modules.
'ui.router',
'restangular',
'angular.filter',
'ui.bootstrap',
'pascalprecht.translate',
// Custom modules.
'myApp.config'
])
.
.
.
Share
Improve this question
edited May 15, 2015 at 19:47
Luis Crespo
asked May 15, 2015 at 19:38
Luis CrespoLuis Crespo
1,6301 gold badge20 silver badges33 bronze badges
7
-
As it says,
If registering a module ensure that you specify the dependencies as the second argument.
-- so, did you? I.e. could you show a bit more of your code, if you did specify dependencies correctly. – jmustonen Commented May 15, 2015 at 19:41 - yep I did specify the 'pascalprecht.translate' dependency. I'm updating the question to show a bit of my app.js – Luis Crespo Commented May 15, 2015 at 19:43
-
Ok, things do look to be ok.. did you already check with your browser's network monitor, that the
angular-translate.js
file is indeed loading correctly? – jmustonen Commented May 15, 2015 at 19:52 - Yes. The browser is indeed loading the file correctly. angular-translate.js is in the loaded resources. – Luis Crespo Commented May 15, 2015 at 19:55
- Ok, seems quite weird. Was everything working until you introduced angular-translate? What if you now remove angular-translate dependency and the angular-translate.js from loading? – jmustonen Commented May 15, 2015 at 20:02
3 Answers
Reset to default 2I had faced same problem, resolved it by adding below entries. Also remeber to put these .js files in correct order too.
files : [
'../js/libs/angular.js',
'../libs/angular-route.js',
'../angular-translate.min.js',
'../libs/angular-translate-loader-url.js',
Hope, this helps.
Regards, Aditi.
It was failing because of another dependency throwing an error, specifically jquery.easy-pie-chart. I wasn't using that dependency at all so I removed it and angular-translate started working without a problem.
I had other modules depending on the translation module, so I was able to fix this error by loading it right after loading angular itself.
本文标签: javascriptangulartranslate module 39pascalprechttranslate39 not foundStack Overflow
版权声明:本文标题:javascript - angular-translate module 'pascalprecht.translate' not found - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741894534a2403500.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论