Angular · Junior · Question 58 of 75

How do you show a "Page not found" component for unknown URLs?

{ path: '**', component: NotFound }

Explanation

The router uses the first matching route, so the wildcard must be last, otherwise it would catch every URL.

Further reading

Problem with a question

Angular · Junior · question 58

Test yourself

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

Take this quiz