I have these two functions and this is a sample of code
var getRangeTime = function(numSerie){
$http.get("data/tempsgammes.json").then(function(res){
return $scope.time = res.data[numSerie].temps
})}
var updateScreen = function() {
$http.get("http://localhost:5000").then(function(response){
$scope.numSerie = response.data.refDetail.Num_Serie
$scope.numTeam = response.data.team
$scope.t = getRangeTime($scope.numSerie)
//Rest of code the code
}
Here what I want to do :
First of all, I call the function updateScreen() to get the Serial Number (numSerie), then depending on the value of numSerie, another function getRangeTime() will be exectued to get the time, and then the function updateScreen() will continue her execution using the result of getRangeTime().
The problem here is the asynchronous, I mean the updateSreen() should wait getRangeTime() until she returns the desired value, it's kind of async and await.
I've tried it but it didn't work and actually I don't know how to use them very much, I searched here and I tried the existing solutions but it didn't go well too, I got always the undefined.
Can anyone help me ?