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>();
}

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().

Further reading

Problem with a question

Angular · Junior · question 53

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