Skip to content

Commit 6312961

Browse files
committed
docs(material/form-field): Update form-field docs & examples (#29245)
(cherry picked from commit 243cdf0)
1 parent 60d3317 commit 6312961

20 files changed

+263
-210
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import {Component} from '@angular/core';
1+
import {ChangeDetectionStrategy, Component} from '@angular/core';
2+
import {MatFormFieldModule} from '@angular/material/form-field';
23
import {MatIconModule} from '@angular/material/icon';
34
import {MatInputModule} from '@angular/material/input';
4-
import {MatFormFieldModule} from '@angular/material/form-field';
55

66
/** @title Form field appearance variants */
77
@Component({
88
selector: 'form-field-appearance-example',
99
templateUrl: 'form-field-appearance-example.html',
1010
standalone: true,
1111
imports: [MatFormFieldModule, MatInputModule, MatIconModule],
12+
changeDetection: ChangeDetectionStrategy.OnPush,
1213
})
1314
export class FormFieldAppearanceExample {}
Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
<div role="group" class="example-tel-input-container"
2-
[formGroup]="parts"
3-
[attr.aria-labelledby]="_formField.getLabelId()"
4-
(focusin)="onFocusIn($event)"
5-
(focusout)="onFocusOut($event)">
6-
<input class="example-tel-input-element"
7-
formControlName="area" size="3"
8-
maxLength="3"
9-
aria-label="Area code"
10-
(input)="_handleInput(parts.controls.area, exchange)"
11-
#area>
1+
<div
2+
role="group"
3+
class="example-tel-input-container"
4+
[formGroup]="parts"
5+
[attr.aria-labelledby]="_formField?.getLabelId()"
6+
(focusin)="onFocusIn()"
7+
(focusout)="onFocusOut($event)"
8+
>
9+
<input
10+
class="example-tel-input-element"
11+
formControlName="area"
12+
size="3"
13+
maxLength="3"
14+
aria-label="Area code"
15+
(input)="_handleInput(parts.controls.area, exchange)"
16+
#area
17+
/>
1218
<span class="example-tel-input-spacer">&ndash;</span>
13-
<input class="example-tel-input-element"
14-
formControlName="exchange"
15-
maxLength="3"
16-
size="3"
17-
aria-label="Exchange code"
18-
(input)="_handleInput(parts.controls.exchange, subscriber)"
19-
(keyup.backspace)="autoFocusPrev(parts.controls.exchange, area)"
20-
#exchange>
19+
<input
20+
class="example-tel-input-element"
21+
formControlName="exchange"
22+
maxLength="3"
23+
size="3"
24+
aria-label="Exchange code"
25+
(input)="_handleInput(parts.controls.exchange, subscriber)"
26+
(keyup.backspace)="autoFocusPrev(parts.controls.exchange, area)"
27+
#exchange
28+
/>
2129
<span class="example-tel-input-spacer">&ndash;</span>
22-
<input class="example-tel-input-element"
23-
formControlName="subscriber"
24-
maxLength="4"
25-
size="4"
26-
aria-label="Subscriber number"
27-
(input)="_handleInput(parts.controls.subscriber)"
28-
(keyup.backspace)="autoFocusPrev(parts.controls.subscriber, exchange)"
29-
#subscriber>
30+
<input
31+
class="example-tel-input-element"
32+
formControlName="subscriber"
33+
maxLength="4"
34+
size="4"
35+
aria-label="Subscriber number"
36+
(input)="_handleInput(parts.controls.subscriber)"
37+
(keyup.backspace)="autoFocusPrev(parts.controls.subscriber, exchange)"
38+
#subscriber
39+
/>
3040
</div>

src/components-examples/material/form-field/form-field-custom-control/form-field-custom-control-example.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<mat-icon matSuffix>phone</mat-icon>
66
<mat-hint>Include area code</mat-hint>
77
</mat-form-field>
8+
<p>Entered value: {{form.valueChanges | async | json}}</p>
89
</div>

0 commit comments

Comments
 (0)