POV
POV

Reputation: 12015

When to use resolvers Angular?

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

Answers (1)

jordanpowell88
jordanpowell88

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

Related Questions