Loading not dismiss


#1

I’m trying to present a Loading on the app RootNav and then dismiss it from another Page,
I tried to store the created loading in a Promise which return from the Show() function, but still when there is more than one Loading presented , some of them are not dismissed.
any way to detected if the top most view of the nav is loading and dismiss it?
I’m using beta6 , any idea ?
Trying to get some sort of singleton service as ionic1 $loading service…

    // Show 
    show(): Promise<Loading> {
               let loading = Loading.create({ showBackdrop: false });
                loading.onDismiss(() => {
                    console.log('onDismiss =======================');
                });
                this._rootNav.present(loading).then(() => {
                    console.log('present =======================');
                });
                return Promise.resolve(loading);
    }

    // Hide
    hide(promise: Promise<Loading>) {
    if (this._rootNav) {
                promise.then((overlay: Loading) => {
                    if (overlay) {
                        overlay.dismiss().then(() => {
                            console.log('dismissed');
                        });
                    }
                });
            }
    }


// Call

let _loadingPromise = show();

.. do some stuff

hide(_loadingPromise);

How to dismiss loading overlay component
#2