I make a get call and retrieve some data that I want to use to make another get call and place that data within the $scope. Something like this.
$http.get('api/url/items').then(function(res){
$scope.items = res.data;
$http.get('api/url/names/' + res.data[0].id).then(function(res){
console.log(res.data.name);
$scope.name = res.data.name;
}
}
The $scope.items is being populated but the $scope.name is not. The console.log gives the correct data but seemingly after the view as been rendered. How can I get the second $http.get to populate the within the $scope before rendering the view?