diff --git a/adev/src/content/tools/cli/template-typecheck.md b/adev/src/content/tools/cli/template-typecheck.md index 760d47033b6..a41c9d3449e 100644 --- a/adev/src/content/tools/cli/template-typecheck.md +++ b/adev/src/content/tools/cli/template-typecheck.md @@ -201,22 +201,29 @@ See [Improving template type checking for custom directives](/guide/directives/s ## Input setter coercion -Occasionally it is desirable for the `input()` property of a directive or component to alter the value bound to it, typically using a `transform` function for the input. +Occasionally it is desirable for an input of a directive or component to alter the value bound to it, typically in the input's setter. As an example, consider this custom button component: -Consider the following directive: - ```angular-ts @Component({ selector: 'submit-button', template: `
- +
`, }) class SubmitButton { - disabled = input.required({transform: booleanAttribute}); + private _disabled = false; + + @Input() + get disabled(): boolean { + return this._disabled; + } + + set disabled(value: boolean) { + this._disabled = value; + } } ```