GeoLocation not working after view change


#1

Always shows the error in both ios and Android

var posOptions = {
      enableHighAccuracy: false,
        timeout : 1000,
         maximumAge: 0
    };
    var watch = $cordovaGeolocation.watchPosition(posOptions);
    watch.then(
      null,
      function (err) {
        console.log(err);
        $ionicPopup.alert({
          title: 'Warning!',
          template: 'Location service is not enabled on your device. Please enable to view the distances towards the holes'
        });
      },

      function (position) {
        console.log(position)
      });
    $cordovaGeolocation.clearWatch(watch.watchID);

#2

This is fixed using platform ready function :yum: