AngularJS Geolocation Service

Here 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.

Note: If you found this helpful, you may also find my geocoding example, which builds on this example, useful as well.

If you have any changes, just fork it on JSFiddle (or gist).