AngryJS AngryJS - 5 months ago 42
AngularJS Question

How can I use HTML5 geolocation in angularjs

How can I use HTML5 geolocation in angularjs? I can get it using HTML5; but how can I pass it to angularjs scope in controller? any sample jsfiddle will save my day!


you can do something

myApp.controller('fooCtrl', function($scope){
  if (navigator.geolocation) {
        $scope.position = position;

you need to do $scope.$apply to trigger the digest cycle when the geolocation arrives and to update all the watchers.