Search code examples
angularangular-routing

Angular resolver cancelling loading route component


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.


Solution

  • Use LocalStorage or SessionStorage or SharedService, set a flag to decide whether to route to the component or not.