I’m working on a project for my company and deeply respecting the NDA that I have signed I provide the following code snippet without any sensitive information, consider this code:
toggleLoadingAnimation()
Subscription1()
Subscription2()
…
Subscription10()
toggleLoadingAnimation()
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.10/angular.min.js"></script>
The problem is that all the Subscription methods are async, they all look like that:
this.randomFieldSubscription = this.randomService.randomEntityList.value$.subscribe(entityList => {this.entityList = entityList})
When the .subscribe gets executed we also send a request to the server inside the randomService.
How do I make the second toggleLoadingAnimation() get executed only when all the previous Subscriptions are done and all responses from the server are recieved?