NG.V · Angular 22 practice question
Inside a 'redirectTo' function, a developer tries to inspect the route's resolved title and lazy-loaded component on the 'ActivatedRouteSnapshot' argument, but they are unavailable. Why does this happen?
Check answer and explanation
Correct answer: Some route data, such as resolved titles and lazy-loaded components, is not accurately known during the route matching phase
Explanation
Because redirectTo runs during route matching, only partial ActivatedRouteSnapshot data is available; details like resolved titles and lazy-loaded components are not yet accurately known.
Common trap
Redirect functions do receive partial ActivatedRouteSnapshot data, so claiming none is provided is inaccurate. Routing strategy (hash vs path) does not change the lifecycle timing of when titles are resolved or lazy components are loaded.
Source: Angular docs: Redirecting Routes — Conditional redirects
Checked against the cited text on 2026-11-25.