I have on my controller:
$scope.test= function () {
var var1 = 0;
var var2 = 0;
var1 = TestService.loadVariable("1")
var2 = TestService.loadVariable("2")
$scope.result = var1 + var2;
}
and my service is:
loadVariable : function(name) {
return $http({
method: 'GET',
url: "/test/sheet/loadVariable/",
params: {name: name},
}).then(function success(response) {
return response.data;
}, function error(response) {
});
},
The problem is that I always get the result and I think it's because I do not have time to execute the loadvariables methods, any suggestions?