This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed input box validation logic (#171)
- Loading branch information
1 parent
6cb6047
commit 0b8271c
Showing
5 changed files
with
322 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 41 additions & 2 deletions
43
src/app/public/modules/input-box/fixtures/input-box.component.fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,54 @@ | ||
import { | ||
Component, | ||
Input | ||
Input, | ||
OnInit, | ||
ViewChild | ||
} from '@angular/core'; | ||
|
||
import { | ||
FormControl, | ||
FormGroup, | ||
NgModel, | ||
Validators | ||
} from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-input-box-fixture', | ||
templateUrl: './input-box.component.fixture.html' | ||
}) | ||
export class InputBoxFixtureComponent { | ||
export class InputBoxFixtureComponent implements OnInit { | ||
|
||
@Input() | ||
public basicDisabled: boolean; | ||
|
||
@Input() | ||
public hasErrors: boolean; | ||
|
||
public errorField: FormControl; | ||
|
||
public errorForm: FormGroup; | ||
|
||
public errorNgModelValue: string; | ||
|
||
@ViewChild('errorNgModel') | ||
public errorNgModel: NgModel; | ||
|
||
public ngOnInit(): void { | ||
this.errorField = new FormControl( | ||
'', | ||
[ | ||
Validators.required | ||
] | ||
); | ||
|
||
this.errorForm = new FormGroup({ | ||
errorFormField: new FormControl( | ||
'', | ||
[ | ||
Validators.required | ||
] | ||
) | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.