# Loading Service within injectable

**URL:** <https://forum.ionicframework.com/t/loading-service-within-injectable/57751>\
**Category:** ionic-v3\
**Created:** [July 17, 2016, 4:25pm UTC](https://forum.ionicframework.com/t/loading-service-within-injectable/57751 "2016-07-17T16:25:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![avilao](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@avilao](https://forum.ionicframework.com/u/avilao)\
**Post date:** [July 17, 2016, 4:25pm UTC](https://forum.ionicframework.com/t/loading-service-within-injectable/57751/1 "2016-07-17T16:25:38Z")

</div>

You can call the Loading from within a page with something like::

```auto
 let loading = Loading.create({
                content: ''
            });
this.nav.present(loading);

```

But if I want to call the loading screen everytime I’m waiting for an http response that comes from any service, how can I separate the waters? I mean, i shouldn’t make all the services call the loading screen while they wait. That wouldn’t be decoupled.

Thanks in advance for the help.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 17, 2016, 8:07pm UTC](https://forum.ionicframework.com/t/loading-service-within-injectable/57751/2 "2016-07-17T20:07:11Z")

</div>

One way would be to have a publicly exposed variable in a service that represents a count of currently open requests. Each time a request starts, you increment it. Each time a request returns (or errors), you decrement it. Then, in any relevant component, you could inject that service and use `openNetworkRequests > 0` as a trigger for selectively displaying your loading spinner.
