Reputation: 12015
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?
Upvotes: 0
Views: 101
Reputation: 837
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.
Upvotes: 2