I have the following function that performs a request to an API using the Angular and would like the function to return the data, but I'm having variable scope problems:
var buscarVagasPorEndereco = function(){
var enderecosVagas = [];
$http.get("dados.json").then(function(response){
enderecosVagas = response.data.enderecosVagas;
});
return enderecosVagas;
};