this is my code :
var updateScreen = function() {
$http.get("http://localhost:5000").then(function(response){
$scope.numSerie = response.data.refDetail.Num_Serie;
$http.get("data/tempsgammes.json").then(function(res){
$scope.time = res.data[$scope.numSerie].temps;
console.log($scope.time)
})
console.log($scope.time)
}
The first $http.get("http://localhost:5000") returns a list of details that I use in the rest of the code, what interests us is the variable numSerie.
Depending on the value of numSerie, another $http.get("data/tempsgammes.json") will be executed to extract the time for this numSerie from a JSON file.
The problem is I cannot get access to the $scope.time only in the second call for $http. The first console.log() gave me the desired result, but the second one undefined.
Can anyone help me ?