Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

How to set a timer for provider to show a message if not return a value?

$
0
0

@anespa wrote:

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

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>