-
Notifications
You must be signed in to change notification settings - Fork 14
fix: optimization tags input #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@alauda/ui": patch | ||
| --- | ||
|
|
||
| fix: optimize tags input |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,232 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Component } from '@angular/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ComponentFixture, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TestBed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fakeAsync, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@angular/core/testing'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ReactiveFormsModule, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FormControl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Validators, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FormGroup, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidatorFn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AbstractControl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AsyncValidatorFn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@angular/forms'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { By } from '@angular/platform-browser'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { TagsInputComponent } from './tags-input.component'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { of } from 'rxjs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('TagsInputComponent Required Validation Behavior', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let fixture: ComponentFixture<TestFormComponent>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let testHost: TestFormComponent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let inputEl: HTMLInputElement; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let tagComp: TagsInputComponent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| beforeEach(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture = TestBed.createComponent(TestFormComponent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tagComp = fixture.debugElement.query( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| By.directive(TagsInputComponent), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).componentInstance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost = fixture.componentInstance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const el = fixture.debugElement.query( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| By.css('.aui-tags-input'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).nativeElement; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl = el.querySelector('input'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // it('should mark form valid when input has value but tag is not confirmed yet', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // expect(testHost.form.valid).toBeFalsy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // inputEl.value = 'hello'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // expect(testHost.form.valid).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // expect(testHost.form.valid).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // expect(testHost.form.get('tags')!.value).toEqual(['hello']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('allowRepeat Behavior', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should NOT allow duplicate tags when allowRepeat = false', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.allowRepeat = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'a'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'a'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual(['a']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should allow duplicate tags when allowRepeat = true', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.allowRepeat = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'a'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'a'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual(['a', 'a']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('allowEmpty Behavior', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should NOT add empty tag when allowEmpty = false', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.allowEmpty = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should add empty tag when allowEmpty = true', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.allowEmpty = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual(['']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('inputValidator behavior', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should NOT add tag when input does NOT pass inputValidator', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.checkFn = control => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const value = control.value as string[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (value.includes('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { patternB: true }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'apple'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(tagComp.model).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.valid).toBeFalsy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should add tag when input passes inputValidator', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.checkFn = control => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const value = control.value as string[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (value.includes('a')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { patternB: true }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'ccc'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+150
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing change detection after setting validator. After setting Apply this diff: };
+ fixture.detectChanges();
+
inputEl.value = 'ccc';
inputEl.dispatchEvent(new Event('input'));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(tagComp.model).toEqual(['ccc']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual(['ccc']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.valid).toBeTruthy(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('inputAsyncValidator behavior', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should block adding tag when async validator resolves to false', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.inputAsyncValidator = (_control: AbstractControl) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| of({ tagAsyncInvalid: true }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'bad'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should allow adding tag when async validator resolves to true', fakeAsync(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testHost.inputAsyncValidator = (_control: AbstractControl) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Promise.resolve(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.value = 'hello'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('input')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputEl.dispatchEvent(new Event('blur')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tick(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture.detectChanges(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(testHost.form.get('tags')!.value).toEqual(['hello']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Component({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| template: ` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <form [formGroup]="form"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <aui-tags-input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| formControlName="tags" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [allowRepeat]="allowRepeat" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [allowEmpty]="allowEmpty" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [inputValidator]="checkFn" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [inputAsyncValidator]="inputAsyncValidator" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ></aui-tags-input> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </form> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| imports: [ReactiveFormsModule, TagsInputComponent], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class TestFormComponent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| allowRepeat = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| allowEmpty = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputAsyncValidator: AsyncValidatorFn = (_control: AbstractControl) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Promise.resolve(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkFn: ValidatorFn = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| form = new FormGroup({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tags: new FormControl<string[]>([], Validators.required), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.