File tree 2 files changed +11
-8
lines changed
src/components-examples/material/form-field/form-field-custom-control
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
< div [formGroup] ="form ">
2
- < mat-form-field appearance ="fill ">
3
- < mat-label > Phone number</ mat-label >
4
- < example-tel-input formControlName ="tel " required > </ example-tel-input >
5
- < mat-icon matSuffix > phone</ mat-icon >
6
- < mat-hint > Include area code</ mat-hint >
7
- </ mat-form-field >
2
+ < mat-form-field appearance ="fill ">
3
+ < mat-label > Phone number</ mat-label >
4
+ < example-tel-input formControlName ="tel " required > </ example-tel-input >
5
+ < mat-icon matSuffix > phone</ mat-icon >
6
+ < mat-hint > Include area code</ mat-hint >
7
+ </ mat-form-field >
8
8
</ div >
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ export class MyTelInput
63
63
parts : FormGroup ;
64
64
stateChanges = new Subject < void > ( ) ;
65
65
focused = false ;
66
- errorState = false ;
67
66
controlType = 'example-tel-input' ;
68
67
id = `example-tel-input-${ MyTelInput . nextId ++ } ` ;
69
68
describedBy = '' ;
@@ -129,6 +128,10 @@ export class MyTelInput
129
128
this . stateChanges . next ( ) ;
130
129
}
131
130
131
+ get errorState ( ) : boolean {
132
+ return this . parts . invalid && this . parts . dirty ;
133
+ }
134
+
132
135
constructor (
133
136
formBuilder : FormBuilder ,
134
137
private _focusMonitor : FocusMonitor ,
@@ -185,7 +188,7 @@ export class MyTelInput
185
188
this . describedBy = ids . join ( ' ' ) ;
186
189
}
187
190
188
- onContainerClick ( event : MouseEvent ) {
191
+ onContainerClick ( ) {
189
192
if ( this . parts . controls . subscriber . valid ) {
190
193
this . _focusMonitor . focusVia ( this . subscriberInput , 'program' ) ;
191
194
} else if ( this . parts . controls . exchange . valid ) {
You can’t perform that action at this time.
0 commit comments