Help on loading controllers

Hi all,

Could you please advise me on this? I have been using loading controller across my app and its mostly during the providers fetching or saving the data, the controller is presented. The loading controller is coded the component while the providers are called to fetch or save the data. However, there might be scenarios when my provider fails during run time. I am handling the errors through a custom error handler globally. However, I am not able to dismiss the loading controller. My question is how to get active loading controllers and dismiss them in my custom error handler? BTW, I will be navigating to a different page in the custom error handler and it works fine, just that the loading controller overlay exists whatsoever.


While you wait for somebody to answer this specific question, I’m going to try to convince you not to do this.

The principle of separation of concerns is IMHO one of the most crucial things to think about when designing code structure, and whenever I have a design that looks like this:

Zone A: spawn a bunch of stuff; somebody will be along to clean it up later
Zone B: seek out unwanted stuff and clean it up

…I always hate myself later.

What I would do instead is localize all loading controller handling somewhere. Whether that’s in the pages that spawn requests, in an interceptor, in a service: that’s up to you. But I would avoid any design that involves having to worry about “how to get active loading controllers”.

Thanks for the advice @rapropos , I have separated loading into a different service and trying to use it. It seems to be working better. More over I enabled the option to disable the loader on page change which gives me some more flexibility.