Use a service that is shared between Http
(there are answers already how about wrapping Http
in your own class) and the <spinner-component>
.
See also https://angular.io/docs/ts/latest/cookbook/component-communication.html
In the shared service maintain a counter of started (increase) and completed/failed HTTP requests and notify the <spinner-component>
every time when the counter changes from 0
to >0
or from >0
to 0
to enable or disable itself.