Angular · Middle · Question 65 of 75

What does redirectTo as a function allow?

{ path: 'profile', redirectTo: () => inject(Auth).isAdmin() ? '/admin' : '/me' }

Explanation

It can also read route params and return a UrlTree. For checks that can deny access, guards are still clearer.

Further reading

Problem with a question

Angular · Middle · question 65

Test yourself

Take the Angular · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz