Skip to content

Commit

Permalink
Fixed #8067 - Add unique attribute to Autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Aug 20, 2019
1 parent 4f682cb commit cea25a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export class AutoComplete implements AfterViewChecked,AfterContentInit,DoCheck,O

@Input() dropdownIcon: string = "pi pi-caret-down";

@Input() unique: boolean = true;

@Output() completeMethod: EventEmitter<any> = new EventEmitter();

@Output() onSelect: EventEmitter<any> = new EventEmitter();
Expand Down Expand Up @@ -392,7 +394,7 @@ export class AutoComplete implements AfterViewChecked,AfterContentInit,DoCheck,O
if (this.multiple) {
this.multiInputEL.nativeElement.value = '';
this.value = this.value||[];
if (!this.isSelected(option)) {
if (!this.isSelected(option) || !this.unique) {
this.value = [...this.value,option];
this.onModelChange(this.value);
}
Expand Down

0 comments on commit cea25a8

Please sign in to comment.