Unknown cookie provider
I am trying to use AngularJS translations. The problem I am facing is that I am getting an error Unknown provider: $$cookieReaderProvider <- $$cookieReader <- $cookies <- $cookieStore <- $translateCookieStorage <- $translate <- $cookies
when I try to use$translateProvider.useCookieStorage();
I injected ngCookies
as a dependency in my application:
var nfqApp = angular.module('myApp', ['postServices', 'angularFileUpload', 'ngSanitize', 'ui.date',
'bootstrapLightbox', 'profileServices', 'ngRoute', 'angularMoment', 'pascalprecht.translate', 'ngCookies']);
I have also included the following translation and cookie related files in the following order:
- angular -translate.min.js
- angular -cookies.js
- angular -translate-interpolation-messageformat.js
- angular-translate-storage-cookie.js
- messageformat.js
- en.js
- lt.js
My app config (where I am trying to use cookieStorage:
myApp.config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('lt', {
"OTHER_LIKES" : "{peopleCount, plural, one {# kolega tai mėgsta} few {# kolegos tai mėgsta} other {# kolegų tai mėgsta}}",
"YOU_AND_OTHERS_LIKES" : "{peopleCount, plural, one {Tu ir # kolega tai mėgsta} few {Tu ir # kolegos tai mėgsta} other {Tu ir # kolegų tai mėgsta}}",
"YOU_LIKE" : "Tu mėgsti tai"
});
$translateProvider.translations('en', {
"OTHER_LIKES" : "{peopleCount, plural, one {# colleague likes this} few {# colleagues likes this} other {# colleagues likes this}}",
"YOU_AND_OTHERS_LIKES" : "{peopleCount, plural, one {You and # colleague likes this} few {You and # colleagues likes this} other {You and # colleagues likes this}}",
"YOU_LIKE" : "You like this"
});
$translateProvider.preferredLanguage('lt');
$translateProvider.fallbackLanguage('en');
$translateProvider.addInterpolation('$translateMessageFormatInterpolation');
$translateProvider.useCookieStorage();
}]);
+3
source to share