Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- form: FormGroup;
- ngOnInit() {
- this.form = this.fb.group({
- value: ['', [ Validators.required ], this.checkIfValueIsValid]
- });
- }
- checkIfValueIsValid(control: AbstractControl) {
- return new Promise(resolve => {
- if (control.value === 'invalid_value') {
- resolve({ valueIsValid: true });
- } else {
- resolve(null);
- }
- });
- }
- <form [formGroup]="form">
- <div class="select-group">
- <label>Invalid/Valid</label>
- <cui-select formControlName="value">
- <cui-option [ngValue]="'invalid_value'">
- invalid
- </cui-option>
- <cui-option [ngValue]="'valid_value'">
- valid
- </cui-option>
- </cui-select>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement