Handling loading controller when loading observable (from Firebase)

Hey,

I’m wondering how to handle “loading screen”, when i’m displaying observable data to the user. it seems to cause a lot of error (and pain)

first - should i “ignore” the async nature of the loading controller or better to insert it into the “then”?
load.present(); getData()
or
load.present().then(()->getData()

Second - when to dismiss it?
Assuming that data from the server (Firebase in my case) can: 1. arrive empty 2. not arrive at all 3. arrive in couple of “chunks”…
load.present().then(()=>getData().subscribe((res)=> // loader.dismiss()
How can i know that the data from Firebase was “complete”…?

Thank you very much

Now I have the same doubt.
Could u solve your problem?

I think you should call loader.present() just before calling getData() function and dismiss loader when response received.
e.g.,

this.loader.present();
this.getDate().subscribe((res)=> {
     let data = res.json();
     this.loader.dismiss();
}, (error) => {
    // show error message
    this.loader.dismiss();
});