https://github.com/ghostbar/angular-geocomplete
Angular factory with methods to query Google's API and get GeoData
https://github.com/ghostbar/angular-geocomplete
Last synced: about 1 year ago
JSON representation
Angular factory with methods to query Google's API and get GeoData
- Host: GitHub
- URL: https://github.com/ghostbar/angular-geocomplete
- Owner: ghostbar
- License: mit
- Created: 2014-05-09T07:15:59.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-02-25T22:13:53.000Z (over 10 years ago)
- Last Synced: 2024-10-10T15:29:02.066Z (over 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 12
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
angular-geocomplete
===================
Simple Angular.js factory that gets GeoData from Google Maps's API with a simple name of a City or an Address.
It returns arrays of data and as much options are available for the query. It has two methods: `cities` and `citiesJSON`.
The first one returns an array with just a String with the following data and format: "City Name, State Name or abbreviature, Country Name".
The second method returns an array with a bunch more data formatted as the Google Maps's API does.
More docs on the code.
Usage
-----
Install with bower:
bower install angular-geocomplete --save
Add to your HTML files:
Now, inject to your application:
angular.module('myApp', ['geocomplete']);
Ready to use in your controllers!:
`controller.js:`
```js
// using callbacks
var DemoCtrl = [ '$scope', 'geoComplete', function ($scope, geoComplete) {
geoComplete.cities("San Francisco", function (results) {
$scope.results = results;
});
}];
// using promises
var DemoCtrl = [ '$scope', 'geoComplete', function ($scope, geoComplete) {
geoComplete.cities("San Francisco").then(function (results) {
$scope.results = results;
});
}];
```
Demo
----
1. Plunker: http://plnkr.co/edit/yatsd3Cqg0te6TPMpjLV?p=preview
2. Local: Run ```gulp``` to run tests, generate coverage and load demo or ```gulp serve``` to just load the demo. (a browser window will automatically open to http://localhost:8000)
Tests
-----
- Run ```gulp test```
- Coverage is generated in the ```coverage/``` folder
Author
------
© 2014, Jose Luis Rivas ``.
Contributors
------------
Sha Alibhai (@shalotelli)
License
-------
The files are licensed under the MIT terms.