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.
Continue ReadingHere is a small service I wrote which will use the openweathermap.com weather service in angular.
This can easily be adapted to work with the angular geolocation service I posted last week. You can see this working in the weather service gist, but I removed it in the JSFiddle to keep it simple.
Continue ReadingHere is a small piece of code that can be dropped into an angular project and used to get the users geolocation through the browser.
The first few times I tried it I was hung up on the scope not updating, but $rootScope.$apply
seemed to get around that. Here is a JSFiddle to see how this works.