angularjs-geolocation

WebJar for angularjs-geolocation

Лицензия

Лицензия

MIT
Категории

Категории

JavaScript Языки программирования Angular Взаимодействие с пользователем Веб-фреймворки Geo Прикладные библиотеки Geospatial
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

angularjs-geolocation
Последняя версия

Последняя версия

0.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

angularjs-geolocation
WebJar for angularjs-geolocation
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/arunisrael/angularjs-geolocation

Скачать angularjs-geolocation

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angularjs-geolocation/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angularjs-geolocation</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angularjs-geolocation/
implementation 'org.webjars.bower:angularjs-geolocation:0.1.1'
// https://jarcasting.com/artifacts/org.webjars.bower/angularjs-geolocation/
implementation ("org.webjars.bower:angularjs-geolocation:0.1.1")
'org.webjars.bower:angularjs-geolocation:jar:0.1.1'
<dependency org="org.webjars.bower" name="angularjs-geolocation" rev="0.1.1">
  <artifact name="angularjs-geolocation" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angularjs-geolocation', version='0.1.1')
)
libraryDependencies += "org.webjars.bower" % "angularjs-geolocation" % "0.1.1"
[org.webjars.bower/angularjs-geolocation "0.1.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.bower : angular jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

AngularJS-Geolocation

An angular.js wrapper around window.navigator.geolocation

Bower

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

bower install angularjs-geolocation

or

bower install git://github.com/arunisrael/angularjs-geolocation.git

Usage

  • Add the geolocation module as dependency
  • Inject the geolocation service (yes, it has the same name)
  • Invoke the getLocation method on the geolocation service to retrieve a promise
  • The promise will be resolved with the position returned by window.navigator.getCurrentPosition if the user allows the browser to access their location
  • The promise will be rejected if the user rejects location access or the browser does not support it

Example

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

Demo

See this plunker that displays your latitude/longitude

Error Handling

The geolocation module defines a geolocation-msgs constant holding error msgs that are broadcast if the user rejects location access:

$rootScope.$broadcast('error',CONSTANTS['errors.location.notFound']);

or if the browser does not support geolocation:

$rootScope.$broadcast('error',geolocation_msgs['errors.location.unsupportedBrowser']);

Testing

grunt test

License

The MIT License

Версии библиотеки

Версия
0.1.1