title: Trigger JavaScript error when geo location services disabled
body: <p>In my AngularJS project I am using the following code to get a device's GPS co-ordinates: </p>
  
  <pre><code>// when user clicks on geo button
  $scope.getGeoLocation = function() {
      var geocoder = new google.maps.Geocoder();
      window.navigator.geolocation.getCurrentPosition(function(position) {
          $scope.$apply(function() {
              $scope.position = position;
              var latlng = new google.maps.LatLng($scope.position.coords.latitude, $scope.position.coords.longitude);
              geocoder.geocode({'latLng': latlng}, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                  $scope.searchstring = results[2].formatted_address;
                  $location.search('s', $scope.searchstring);
                  $location.search('p', 1);
                  $location.search('geo', true);
                  $route.reload();
                }
              });
          });
      }, function(error) {
          $scope.error = error;;
      });
  };
  </code></pre>
  
  <p>The problem is when location services is turned off on an iPhone 6, there is a no error created to inform the user that they need to turn on location services. </p>
  
  <p>Does any one know how I can amend the code above to trigger an error in this scenario? Any help would be much appreciated. </p>