why my res.data returns array of objects ? (AngularJs)

The solution for “why my res.data returns array of objects ? (AngularJs)” can be found here. The following code will assist you in solving the problem.

var app = angular.module(‘myApp’, []);
app.controller(‘myCtrl’, function ($scope, $http) {
$scope.pokemons = []

let getPokemons = function () {
$http.get(‘https://pokeapi.co/api/v2/pokemon/?offset={qtd’)
.then(function (res) {
let pokemon = res.data.results
console.log(pokemon)
$scope.pokemons = pokemon;
})
}
getPokemons()
});

  • {{ pokemon.name }}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in