from:http://rangle.io/blog/two-ways-to-build-a-location-picker-for-a-mobile-angularjs-application/
Building mobile apps often requires working with location information. While, the Cordova geo-location plugin makes it quite trivial to get the latitude and longitude values for the user ' s Curr ENT location, "What we often want be location identifiers" That's meaningful to the User-and not necessarily Correspondi Ng to the place where the. Below We look at the ways at the acquiring meaningful location identifiers.
Location-picker
The Location-picker packages this to a simple directive. It utilizes the reverse-geocoder
service to fetch a set of options for the user. The user selection is then bound to the object passed in through the ng-model
attribute.
<!--- <location-picker ng-model= " Pickedlocation " limit-to=" 5 "></location-picker >
Location-lookup
The location-predictions directive generates a set of options which is passed into the location-lookup directive. Which in turn displays them as a lists for the user to choose from. Once the user picks a location it uses the Google Places service to fetch the geo-location data for it.
<!--- <location-lookup ng-model= " Lookeduplocation " limit-to=" 4 "></location-lookup >
Usage
Both, Location-lookup and location picker, directives is fairly straight forward to use. They essentially behave as a <select>
element. The selection is captured using ng-model
. Optionally you can limit the number of choices by using the limit-to
attribute.
The selection returns data of the following type:
{ ' CN Tower ', ' CN Tower ', Front Street West, Toronto, ON, Canada' ,43.642566 , -79.38705700000003}
It's easy-to-use and we have this kind of requriement in the proejct and can refer to this blog.
Git:https://github.com/winkervsbecks/locator
[Angularjs-app] AngularJS Location-picker App