0

In which cases do you use resolvers in Angular? I think it takes a lot of performance, in which case it has optimize using?

Could I reuse resolver and cache it?

POV
  • 11,293
  • 34
  • 107
  • 201
  • I'd say not much, I did write my thoughts about why not there: https://stackoverflow.com/q/49054232/2398593 – maxime1992 Aug 10 '22 at 09:32

1 Answers1

2

The answer is somewhat subjective to your use-case but essentially any route change that would benefit from having the data already "resolved" could be considered. I would look at any route change that has a high page load. You should be able to cache the data because resolver is just implemented in a service. That service could cache the data from a state management store example: NgRX or even just a private property in the service itself if you make it a singleton.

jordanpowell88
  • 857
  • 3
  • 11
  • 25