ionicLoading globally

Hey guys
I’m kinda new to ionic, I had a work with ionicV1, but now i’m trying some personal projects with ionic2 and I was wondering if I can make Loading globally so I don’t need to import it in every single page…
Is there a way to do that?
Tks :slight_smile:

Yes, but it will end up being fragile and just as much if not more work than just importing it in each page that needs it.

I created a DelayedLoadingService, because I wanted to show loading spinners only if an action takes more than x-many milliseconds, and I didn’t want to repeat that code every page. (The service does some other things too, but that’s the basic idea.) So that’s the only place LoadingController is injected. But – DelayedLoadingService is injected into multiple pages, so there’s no savings over just injecting LoadingController into multiple pages. If all you want to do is use LoadingController, inject it, and const loading = this.loadCtrl.create() … and dismiss.

3 Likes