I want to access values stored in Cookie in config phase of angularjs, how can I do it? Is it possible? I currently have the below code inside app.config(function(..., $translateProvider){...}) which is working perfectly fine:
var defaultLang = 'de-DE';
var moduleName = { moduleName: 'UICaption.Resources' };
$translateProvider.useLoader('customLocalizationLoaderFactory',
{
moduleName, url: resourceUrl
});
$translateProvider.preferredLanguage(defaultLang);
I want to achieve something like(below code) inside app.config(), but I think only providers are registered and accessed during configuration phase, so how should I access the values stored in cookies in config phase via $cookies service or any other way:
var defaultLang = $cookies.get('ASPNET_CULTURE' === 'de-DE') ? 'de-DE' : 'en-US';
var moduleName = { moduleName: 'UICaption.Resources' };
$translateProvider.useLoader('customLocalizationLoaderFactory',
{
moduleName, url: resourceUrl
});
$translateProvider.preferredLanguage(defaultLang);
Please guide if any other approach is there for the same?
Thank you.