Angularjs- translate,injector:modulerr error

时间:2015-02-25 10:27:28

标签: angularjs angular-translate

我正在使用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);
  };
});

1 个答案:

答案 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);
      };
 }]);