angular- 未找到翻译模块 'pascalprecht.translate'
angular-translate module 'pascalprecht.translate' not found
我正在尝试将 angular-translate 添加到我的 angular 应用程序。我遵循了这个简单的快速入门:https://angular-translate.github.io/docs/#/guide,但我的应用不会 bootstrap,出现以下错误:
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.
我的 index.html 文件正确地包括 angular-translate 像这样:
<script src="bower_components/angular-translate/angular-translate.js"></script>
知道为什么会发生这种情况吗?非常感谢您的帮助。
更新
这是我的 app.js 的一部分,以澄清一些事情:
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'
])
.
.
.
由于另一个依赖项引发错误而失败,特别是 jquery.easy-pie-chart。我根本没有使用该依赖项,所以我删除了它,angular-translate 开始正常工作。
我遇到了同样的问题,通过添加以下条目解决了它。还记得把这些 .js 文件也按正确的顺序排列。
files : [
'../js/libs/angular.js',
'../libs/angular-route.js',
'../angular-translate.min.js',
'../libs/angular-translate-loader-url.js',
希望,这对您有所帮助。
此致,
阿迪提.
我有其他模块依赖于翻译模块,所以我能够通过在加载 angular 本身后立即加载它来修复这个错误。
我正在尝试将 angular-translate 添加到我的 angular 应用程序。我遵循了这个简单的快速入门:https://angular-translate.github.io/docs/#/guide,但我的应用不会 bootstrap,出现以下错误:
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.
我的 index.html 文件正确地包括 angular-translate 像这样:
<script src="bower_components/angular-translate/angular-translate.js"></script>
知道为什么会发生这种情况吗?非常感谢您的帮助。
更新
这是我的 app.js 的一部分,以澄清一些事情:
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'
])
.
.
.
由于另一个依赖项引发错误而失败,特别是 jquery.easy-pie-chart。我根本没有使用该依赖项,所以我删除了它,angular-translate 开始正常工作。
我遇到了同样的问题,通过添加以下条目解决了它。还记得把这些 .js 文件也按正确的顺序排列。
files : [
'../js/libs/angular.js',
'../libs/angular-route.js',
'../angular-translate.min.js',
'../libs/angular-translate-loader-url.js',
希望,这对您有所帮助。
此致, 阿迪提.
我有其他模块依赖于翻译模块,所以我能够通过在加载 angular 本身后立即加载它来修复这个错误。