Angular · Middle · Question 12 of 75
What is an input transform used for?
disabled = input(false, { transform: booleanAttribute });
// usage: <app-button disabled />- ✓Correct answer: To convert the bound value before the component receives it, e.g. an empty attribute string to
true - 2To animate the input when it changes
- 3To validate the input and throw if it's invalid
Explanation
Without the transform, <app-button disabled /> would pass an empty string. Angular ships booleanAttribute and numberAttribute; transforms must be pure functions.