I have created some PHP code that whenever an AJAX Call is called anywhere on the site, it displays a modal popup with a loader.
The nice part of this is that I created and initialized it once, and never had to specify a loader again on any other code.
Is this possible to accomplish using Ionic 4 and Angular at all?
Or will I have to specify specifically every time I want to have a loader displayed?
What you can do is create a service and call loaders on each request to the server and call dismiss() loaders accordingly.
Source:- stackoverflow .
Hope this helps
Thank you all! Much appreciated.
I have already implemented interceptors for Authorizations, so I guess this would be the most logic place to just activate and deactivate the loader modals. Fantastic! Thank you!
I’m not sure I understand what happens without the timeout, but map is strictly for transforming foos into bars; it’s a bad place to put actions that have side effects (like dismissing a loading controller). I use the share operator and multiple subscriptions for similar purposes:
Your loading controller overlord could inject this service, subscribe to watchActive(), and pop loading controllers when it goes true and close them when it goes false.