docs: fix the input setter coercion example in the template type checking guide

The "Input setter coercion" section opened with a signal input that uses
`transform: booleanAttribute`, then said that `<submit-button disabled>`
is a type error under strict templates. With that transform the attribute
form compiles, so the example never showed the problem. The rest of the
section is about an `@Input()` setter typed `boolean`.

Use a plain `boolean` getter and setter in the first example so it
matches the text that follows, update the intro sentence to say the value
is altered in the setter, and remove a duplicated "Consider the following
directive:" line.

(cherry picked from commit 567ae3ed66)
This commit is contained in:
Kam
2026-11-16 20:57:37 +00:00
committed by Alon Mishne
parent 0270980bde
commit 33000bb5ca
@@ -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: `
<div class="wrapper">
<button [disabled]="disabled()">Submit</button>
<button [disabled]="disabled">Submit</button>
</div>
`,
})
class SubmitButton {
disabled = input.required({transform: booleanAttribute});
private _disabled = false;
@Input()
get disabled(): boolean {
return this._disabled;
}
set disabled(value: boolean) {
this._disabled = value;
}
}
```