Skip to content

Instantly share code, notes, and snippets.

@seanbehan
Last active February 29, 2016 12:17
Show Gist options
  • Save seanbehan/6def920ab5c7fb79174e to your computer and use it in GitHub Desktop.
Save seanbehan/6def920ab5c7fb79174e to your computer and use it in GitHub Desktop.
Get user's current GPS, longitude and latitude with PhoneGap and Ionic
// install from command line
// cordova plugin add org.apache.cordova.geolocation
.controller('LocationController', function($scope){
navigator.geolocation.getCurrentPosition(function(position){
coords = [position.coords.latitude, position.coords.longitude].join(',')
get("/places.json?location="+coords).success(function(resp){
$scope.places = resp.places
})
}, function(){
/** error */
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment