Angular · Middle · Question 65 of 75
What does redirectTo as a function allow?
{ path: 'profile', redirectTo: () => inject(Auth).isAdmin() ? '/admin' : '/me' }- ✓Correct answer: Computing the redirect target at navigation time, with access to
inject() - 2Redirecting to external websites only
- 3Running the redirect on the server
Explanation
It can also read route params and return a UrlTree. For checks that can deny access, guards are still clearer.