What is a resolver, and when would you use one?
Model answer
A resolver is a function that fetches data before a route is activated, so the component starts with the data ready. It is configured in the route's resolve property and the result is available through route data or input binding.
It avoids showing a half-empty page, but it also delays navigation until the data arrives. For slow calls, it is often better to show the page at once with a loading state. Use resolvers when the page is meaningless without the data or when you want to redirect on a missing item.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.