Page 1 of 1

Problem with the Geoloaction code

Posted: Tue Jan 19, 2016 5:14 am
by Hawk

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.


Problem with the Geoloaction code

Posted: Tue Jan 19, 2016 12:28 pm
by Serhii Kulibaba

Hello,

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


Problem with the Geoloaction code

Posted: Thu Feb 04, 2016 1:47 am
by Hawk

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.


Problem with the Geoloaction code

Posted: Fri Feb 05, 2016 10:33 am
by Serhii Kulibaba

Thank you for update! Glad it works now!