cordovaGeoLocation it doesn't work


Hi I’m an Ionic newbie and I started this morning working with ngCordova but i’m finding problems the controller don’t work when I add $cordovaGeoLocation to it

angular.module('starter', ['ionic','ngCordova'])

.run(function($ionicPlatform, $cordovaGeoLocation) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
if(window.StatusBar) {

.controller(‘MyFirstController’, function($scope){
$scope.currentCoords = {“Longtitude”: “1.59995”, “Latitude”: “15.09965”};
$scope.refresh = function()
var options = { timeout: 10000, enableHighAccuracy:false};
var Longtitude = position.coords.longitude;
var Latitude = position.coords.getLatitude;
$scope.currentCoords = {“Longtitude”: Longtitude, “Latitude”: Latitude};


There are a few things that might be causing this to not work…

  1. Do you have the ngCordova js files installed?
  2. Is GPS turned on the device?
  3. Is the org.apache.cordova.geolocation plugin installed?

Also, you don’t need to call $cordovaGeoLocation in .run portion.


Thank you for the response . The ngCordova js files are installed with : bower install ngCordova also org.apache.cordova.geolocation
but the GPS is not turned on can you tell me how can i do it


What device are you using? It should be a setting on the phone.


It’s ok i configured it and i took a look at permissions at Android Manifest File and the Address Fine Location authorization is set …
I Think that is a problem with ngCordova because the controller don’t provide data to the view, i see blanked data like this : {{ parameter.value }} even before i click on the button to tell the controller to provide the data (Longtitude and Latitude)


I think I have the same issue. For example here, I don’t have any error neither position:

    $scope.findLocation= function()
        $cordovaGeolocation.getCurrentPosition().then(function (position) {
            alert('findLocation: position: ' + position);
            currentLongLat = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            }, function(err) {
                alert('code: '    + err.code    + '\n' + 'message: ' + err.message + '\n');

Any message from above function.