Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Problem with the Geoloaction code

Hi,

I'm trying to follow this tutorial:
https://devcenter.appery.io/documenta...

But something seems not right with this code snippet:
pre
if ($scope.watchId) return;

var requestData = {};

var def = Apperyio.get("Geolocation_watchPosition")(requestData);
def.then(
function(success){

Code: Select all

 }, 
 function(error){ 

 }, 
 function(notify){ 
     if (!notify.isSuccess) return; 
     var la_scope = $scope.la; 
     var lo_scope = $scope.lo; 
     la_scope = notify.result.coords.latitude; 
     lo_scope = notify.result.coords.longitude; 
     $scope.la = la_scope; 
     $scope.lo = lo_scope;         
 }); 

$scope.watchId = def.watchId;
function(notify){
$scope.test = notify.result.coords.latitude;
$scope.count = $scope.count + 1;
//$scope.$apply();
});
/pre

I fiddled a bit with it, I think it should be like this:
pre
if ($scope.watchId) return;

var requestData = {};

var def = Apperyio.get("Geolocation_watchPosition")(requestData);
def.then(
function(success){

Code: Select all

 }, 
 function(error){ 

 }, 
 function(notify){ 
     if (!notify.isSuccess) return; 
     var la_scope = $scope.la; 
     var lo_scope = $scope.lo; 
     la_scope = notify.result.coords.latitude; 
     lo_scope = notify.result.coords.longitude; 
     $scope.la = la_scope; 
     $scope.lo = lo_scope;         
 }); 

$scope.watchId = def.watchId;
function s(notify){
$scope.test = notify.result.coords.latitude;
$scope.count = $scope.count + 1;

Code: Select all

 }; 

/pre

I'm not too sure, It just does not work in the way it is in the tutorial.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with the Geoloaction code

Hello,

Could you clarify, what exactly doesn't work? Can you provide more details, screenshots or exact steps to reproduce this problem?

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Problem with the Geoloaction code

Hi Sergiy,

Following the exact steps in the tutorial, and the same code will produce some error. If you notice, the first script above (from the tutorial) has bracket ')' at the end. I removed it and it worked.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with the Geoloaction code

Thank you for update! Glad it works now!

Return to “Issues”