#ionicLoading service with multiple $http requests

I want to know whether the $ionicLoading service : http://ionicframework.com/docs/api/service/$ionicLoading/ would work if I follow the following formula : http://learn.ionicframework.com/formulas/loading-screen-with-interceptors/ and use 2 $http requests.

The documention says that $ionicLoading.show() :
“Shows a loading indicator. If the indicator is already shown, it will set the options given and keep the indicator shown.”

What if my $http request 1 starts and displays the $ionicLoading, meanwhile, my $http request 2 starts and calls $ionicLoading.show(), so, according to the documentation the loading bar would show.

Now, let’s say $http request 1 ends and tried to call $ionicLoading.hide() but my 2nd $http request is still in process.

Will the $ionicLoading show to get hidden ? Does it handle this case ?

Let me know if I am not clear at any point thanks. Going through the code, might as well answer this by my own.


I think it does not work. Here is a codepen where in I have 2 $http calls in one of which I tried to fake a sleep.

Please comment.

Isn´t it better to call the second service after the first? With .then()?

No, in this case I have two parallel streams running. Calling them one after another will be less performant.