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.