I'm developing an ionic application and I'm having a problem when looping. In this loop there is a call from a method of a provider, which makes a request put
. My problem is that for
does not expect the server to return it to continue execution, how can I synchronize for
with the request?
My code below:
getAtualizados(){
let atualizados: Cadastrolist[]=[];
this.contribuinteProvider.getAtualizados()
.then((result)=>{
atualizados = result;
for (var i = 0; i < atualizados.length; i++){
this.servidorProvider.update(atualizados[i].dados.cadastro)
.then((result)=>{
this.contribuinteProvider.remove(atualizados[i].key);
});
}
});}