File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
src/components-examples/material/form-field/form-field-custom-control Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 11< 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 >
88</ div >
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ export class MyTelInput
6363 parts : FormGroup ;
6464 stateChanges = new Subject < void > ( ) ;
6565 focused = false ;
66- errorState = false ;
6766 controlType = 'example-tel-input' ;
6867 id = `example-tel-input-${ MyTelInput . nextId ++ } ` ;
6968 describedBy = '' ;
@@ -129,6 +128,10 @@ export class MyTelInput
129128 this . stateChanges . next ( ) ;
130129 }
131130
131+ get errorState ( ) : boolean {
132+ return this . parts . invalid && this . parts . dirty ;
133+ }
134+
132135 constructor (
133136 formBuilder : FormBuilder ,
134137 private _focusMonitor : FocusMonitor ,
@@ -185,7 +188,7 @@ export class MyTelInput
185188 this . describedBy = ids . join ( ' ' ) ;
186189 }
187190
188- onContainerClick ( event : MouseEvent ) {
191+ onContainerClick ( ) {
189192 if ( this . parts . controls . subscriber . valid ) {
190193 this . _focusMonitor . focusVia ( this . subscriberInput , 'program' ) ;
191194 } else if ( this . parts . controls . exchange . valid ) {
You can’t perform that action at this time.
0 commit comments