Update screen data after an asynchronous Angular 1.6 call

Asked

Viewed 71 times

1

I have the following problem! I have a form with an id field. this guy is passed to my GET method which is asynchronous. Data comes back perfectly from the server (line $scope.produto = resposta.data), But the data is not updated on the screen. Follow the method:

$scope.buscar = function(produto) {
    console.log(produto)
    ProdutosServices.buscar(produto).then(function(resposta) {
        $scope.produto = resposta.data;
    }); 
};

1 answer

0


Solved guys. My reply object came back an array. Just modify the line:

$Scope.product = response.date

for

$Scope.product = response.data[0]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.