DEV Community

Discussion on: Angular: display a spinner on any component that does an HTTP request

Collapse
 
elasticrash profile image
Stefanos Kouroupis

I ve only used that component in tables and charts and ...even when I had multiple charts per page, that still works fine. Bare in mind that each char subscribed to a different endpoint. So I've never tested it with multiple requests per component.

Because I find the issue intriguing...I am going to spend sometime tomorrow investigating it.

Collapse
 
maszeh profile image
Thalles

I found the problem in my application, it was not a problem because there were multiple subscriptions, the problem is that I was making the backend call at the same time as the component creation happened (changing the route and opening a screen did both) and when I made that call my component had not subscribed to BehaviorSubject yet. I just moved my call to the backend to ngAfterViewInit and everything worked as it should.