Receiving geolocation information from modern web browsers (AngularJS apps)
npm install ngCurrentGeolocation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="ngGeolocation.js"></script>
<script>
var app = angular.module('myApp', ['geolocation']);
app.controller('MyCtrl', ['$scope', 'geolocation', function($scope, geolocation) {
var geoObj = new geolocation;
geoObj.getLocation().then(function(data) {
$scope.coords = {lat: data.coords.latitude, lon: data.coords.longitude};
});
}]);
</script>
</head>
<body ng-app="myApp">
<div ng-controller="MyCtrl">
Coords: {{coords.lat}}, {{coords.lon}}
</div>
</body>
</html>