Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions modules/components/tag-input-form/tag-input-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ export class TagInputForm implements OnInit, OnChanges {
return this.item.value;
}

private _inputText: string;

/**
* @name inputText
* @param text {string}
*/
public set inputText(text: string) {
this.item.setValue(text);

this.inputTextChange.emit(text);
if ( this._inputText != text ) {
this._inputText = text;
this.item.setValue(text);
this.inputTextChange.emit(text);
}
}

private readonly item: FormControl = new FormControl({ value: '', disabled: this.disabled });
Expand Down Expand Up @@ -194,7 +198,6 @@ export class TagInputForm implements OnInit, OnChanges {
* @param $event
*/
public onKeyDown($event) {
this.inputText = this.value.value;
if ($event.key === 'Enter') {
this.submit($event);
} else {
Expand All @@ -217,5 +220,6 @@ export class TagInputForm implements OnInit, OnChanges {
public submit($event: any): void {
$event.preventDefault();
this.onSubmit.emit($event);
this.form.reset();
}
}
2 changes: 1 addition & 1 deletion modules/components/tag-input/tag-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ export class TagInputComponent extends TagInputAccessor implements OnInit, After
* @name hasErrors
*/
public hasErrors(): boolean {
return !!this.inputForm && this.inputForm.hasErrors();
return !!this.inputForm && !!this.inputForm.hasErrors();
}

/**
Expand Down