Geocoding in AngularJS with Geolocation and Google Maps
I’ve been working on an app that asks for the user’s zip code as part of an application process. I thought it would be pretty nice if I could leverage my old angular geolocation service and layer in some geocoding. After browsing around I found a way to do this using the Google Maps geocoder service.
This code will use the brower’s geolocation to determine your latitude/longitude and pass that into the google maps geocode api. The geocoder will return a whole bunch of other details such as your city, state, address, etc - but this code only cares about your zip code right now.
Something to keep in mind is that I’m not including a google maps API key in this example, and I’m not certain what the limitations are, so this isn’t exactly production ready.
If you have any changes, just fork it on JSFiddle (or gist).