I'm learning how to use these methods, but at the time of consuming an APi that I have in Laravel, or assuming that this sometimes delays the return of the results and the results don't appear when the view or page loads, it just looks empty.
Example of a method of consuming an APi. As you can see in the create a api-rest-service.ts file, I place all the routes that I consume
getURLlogo(datos){
return this.http.post(`https://mipagina.com/historial-registros`,datos);
}
Then I try to get the data with the subscription:
this.service.getegitros(datos)
.subscribe(result => {
this.arrayRegistros = result('registros')
}
});
And with this last saving of the data in a variable it works fine when I pass a console.log, but when I want to visualize it in a view it is sometimes visualized and sometimes not. Try to use and import the loadig
import { LoadingController } from '@ionic/angular';
and in the subscribe the loading.dismiss (); But even if I get the same results, does anyone know how to properly wait for the data and then display the records in the view?