Angular · Junior · Question 41 of 75

How are routes configured in an Angular app?

export const routes: Routes = [
  { path: "", component: Home },
  { path: "users/:id", component: UserPage },
  { path: "**", component: NotFound },
];

Explanation

The router matches the URL against paths in order. :id is a route parameter, ** is a wildcard for unknown URLs and should go last.

Further reading

Problem with a question

Angular · Junior · question 41

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