I have an Angular resolver which is fetching data from an external system through a http call. Based on some condition I don't want the resolver to proceed and loading the component in the route. How can we manage this in Angular without using CanActivate. The reason is that I want to fetch this data only once for performance reasons.
1 Answer
Use LocalStorage or SessionStorage or SharedService, set a flag to decide whether to route to the component or not.
2 Comments
stephan.peters
Ok we will put some state on a shared angular service and pre-fetch the data in the guard already which is then eventually used in the resolver if it is allowed...
Srinivasan Sekar
Agree we can use shared service as well