我正在使用angularjs-translate但得到错误:[$ injector:modulerr] http://errors.angularjs.org/1.3.13/ $ injector / modulerr?p0 = pharma 错误,下面是我的参考代码
var app = angular.module('pharma',['pascalprecht.translate']);
app.config('$translateProvider',function($translateProvider){
$translateProvider.translations('en', {
"TITLE":"Angular way!"
});
$translateProvider.translations('fr', {
"TITLE":"angulaire !"
});
$translateProvider.preferredLanguage('en');
});
app.controller('TranslateController', function($translate, $scope) {
$scope.changeLanguage = function (langKey) {
$translate.use(langKey);
};
});
答案 0 :(得分:0)
检查:
var app = angular.module('pharma',['pascalprecht.translate'])
.config(function($translateProvider){
$translateProvider.translations('en', {
"TITLE":"Angular way!"
});
$translateProvider.translations('fr', {
"TITLE":"angulaire !"
});
$translateProvider.preferredLanguage('en');
});
app.controller('TranslateController', ['$translate', '$scope', function($translate, $scope) {
$scope.changeLanguage = function (langKey) {
$translate.use(langKey);
};
}]);