I have a page that calls an API to get some objects to be displayed, I make the call to the api in the constructor and subscribe to it, but before i get any data the page finishes loading with nothing to show.
constructor(public navCtrl: NavController, public userData: UserData, public navParams: NavParams, public profissional: ProfissionalData) {
this.return_values_horarios_livres()
console.log(this.lista_profissional)
}
return_values_horarios_livres(){
return this.profissional.get_horarios_livres(this.clinica_id, this.especialidade_id).subscribe(
data => { this.lista_profissional = data.objects; this._save = data.objects; console.log("pegou aqi"); console.log(data.objects); console.log(this.lista_profissional)},
err => {},
()=>{}
)
}
That console logs prints undefined, which means that the data hasn't been loaded yet.
How do I wait to have something in the variable "lista_profissional" to load the page?
https://stackoverflow.com/questions/44598346/angular-4-binding-images-cannot-read-property-of-undefined/44598634#44598634
– Rodolfo Pazos Rivas Jun 19 '17 at 17:26