I have a little problem. The API data from the code below appears normally on the console, it returns an array with the data, but I can't return them to use them in the front-end. PS: that "name here!" I can use it on the front, the query cannot.
I'm using angularJS.
$scope.getCharacters = function() {
$scope.teste = "name here!";
axios.get(baseUrl + "/characters" + complemento)
.then(function (res) {
console.log(res.data.data.results) // returns API data normally, communication is working
var heroes = res.data.data.results;
return heroes;
})
.catch(function (err) {
console.log(err)
});
console.log(heroes)
}
$scope.getCharacters();