ngCurrentGeolocation

1.0.0 • Public • Published

ngCurrentGeolocation

Receiving geolocation information from modern web browsers (AngularJS apps)

Installation

npm install ngCurrentGeolocation

Example

<!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>

Readme

Keywords

none

Package Sidebar

Install

npm i ngCurrentGeolocation

Weekly Downloads

0

Version

1.0.0

License

none

Last publish

Collaborators

  • mikielis