Skip to content

Commit c0e2364

Browse files
kirjsthePunderWoman
authored andcommitted
docs(forms): use touch.emit() in custom controls example
1 parent 20fb11b commit c0e2364

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

adev/src/content/guide/forms/signals/custom-controls.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ The minimal controls shown above work, but they don't respond to form state. You
245245
Here's a comprehensive example that implements common state properties:
246246

247247
```angular-ts
248-
import {Component, model, input, ChangeDetectionStrategy} from '@angular/core';
248+
import {Component, model, input, output, ChangeDetectionStrategy} from '@angular/core';
249249
import {
250250
FormValueControl,
251251
WithOptionalFieldTree,
@@ -266,7 +266,7 @@ import {
266266
[readonly]="readonly()"
267267
[class.invalid]="invalid()"
268268
[attr.aria-invalid]="invalid()"
269-
(blur)="touched.set(true)"
269+
(blur)="touch.emit()"
270270
/>
271271
272272
@if (invalid()) {
@@ -293,7 +293,8 @@ export class StatefulInput implements FormValueControl<string> {
293293
value = model<string>('');
294294
295295
// Writable interaction state - control updates these
296-
touched = model<boolean>(false);
296+
touched = input<boolean>(false);
297+
touch = output<void>();
297298
298299
// Read-only state - form system manages these
299300
disabled = input<boolean>(false);

0 commit comments

Comments
 (0)