0

I use library Angular Google Maps In documentation I have not found nothing about geolocation. I need use an optional plug-in for it? How to use geolocation in this library?

vaved
  • 129
  • 1
  • 1
  • 12
  • It doesn't look like that library has location services. You'll probably need a different library or maybe try using [html5 geolocation](http://stackoverflow.com/questions/23185619/how-can-i-use-html5-geolocation-in-angularjs). – Andy May 20 '15 at 15:55

1 Answers1

0

I have used AngularJS-Geolocation. It is easy to use this library to obtenir the geolocation without security limits like HTTPS requirements. (If you are trying to use window.navigator.geolocation, it will require HTTPS for safty reason.)

This module is available as bower package, install it with this command:

bower install angularjs-geolocation

The usage like this

angular.module('barterApp',['geolocation'])
  .controller('geoCtrl', function ($scope,geolocation) {
    geolocation.getLocation().then(function(data){
      $scope.coords = {lat:data.coords.latitude, long:data.coords.longitude};
    });
});

Here is a live demo. Hope this could be helpful.

Hongbin Wang
  • 1,186
  • 2
  • 14
  • 34