Angular · Junior · Question 53 of 75
How do you declare an input that the parent must always provide?
export class UserCard {
user = input.required<User>();
}- ✓Correct answer: With
input.required<T>()- the compiler reports an error if the parent doesn't bind it - 2With
input<T>()and a!after the name - 3Inputs can't be required in Angular
Explanation
A required input has no default value, so its type doesn't include undefined. Read it in the template or class as a signal: user().