Angular · Middle · Question 32 of 75
What does withComponentInputBinding() enable?
provideRouter(routes, withComponentInputBinding());
// route: users/:id
export class UserPage {
id = input.required<string>();
}- ✓Correct answer: Route params, query params and resolved data are bound to component inputs with matching names
- 2Components can change the route by writing to their inputs
- 3All inputs become optional
Explanation
Instead of injecting ActivatedRoute and subscribing to paramMap, the component simply declares an input. It updates when you navigate between /users/1 and /users/2 while staying on the same component.