When I call cordovaGlobalization in controllers, it works fine, but when I call it in Services, it raises an error that cordovaGlobaliztion is undefined!
The following code works fine.
.controller('SettingsController', function($scope, $cordovaGlobalization) {
$cordovaGlobalization.getLocaleName().then(
function(result) {
console.log('getLocalName()');
console.log(result.value);
},
function(error) {
alert('error with getLocaleName');
});
})
But this one does not work
.factory('AppService', function($cordovaGlobalization) {
return {
country: function() {
$cordovaGlobalization.getLocaleName().then(
function(result) {
console.log('getLocalName()');
console.log(result.value);
},
function(error) {
alert('error with getLocaleName');
});
}
})