Reputation: 1648
I am learning the use of Angular Route Resolvers, and from some sources on web, I get idea that those are used to perform actions after the navigation event and before our component is loaded.
But, if I can control the loading of DOM using structural directives like *ngIf
and perform required actions in ngOnInit()
before loading of DOM, then what is the use case of resolvers.
Are they efficient and performance optimizers? Is there specific case where I have no option other than using resolvers?
(I am referring to https://stackblitz.com/edit/angular-route-resolvers as an example).
Upvotes: 1
Views: 263
Reputation: 1256
I find the resolver useful in these 2 cases:
For everything else I use *ngIf
Upvotes: 0
Reputation: 692171
Resolvers can be useful for many reasons:
Their downsides is that
Upvotes: 2