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?
1 Answer
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.