Friends,
I have a form with combo values load based on the provider data… If there is no data for that provider the loader spins indefinitely.I need to show a reasonable message like “The Service not available” after some time .
My relevant code is
getZonalOffice(lbid,lbtype) {
let loader = this.loadingController.create({
content: "Loading Zonal Office ... "
});
loader.present();
this.propertyProvider.getZonalOffice(lbid)
.then(data => {
if(lbtype == 5 || lbtype == 3) {
data.shift();
}
alert(JSON.stringify(data)); // it will not work when no data available
this.zonaloffices = data;
//changed code below
if(this.zonaloffices.length == 1 && this.zonaloffices[0].zonal_name_eng == "Main Office") {
this.data.zonaloffice = this.zonaloffices[0].zonal_id;
}
loader.dismiss();
})
}
Please advise
Thanks
Anes