on ne peut pas ajouter plusieurs fois le memme 'centre d'interet'/'sujet'
This commit is contained in:
parent
0ea00bf062
commit
326ea73b86
5 changed files with 28 additions and 18 deletions
|
|
@ -55,7 +55,7 @@ export class InputInterestsProfilComponent implements OnInit
|
|||
add(event: MatChipInputEvent): void
|
||||
{
|
||||
const value = (event.value || '').trim();
|
||||
if (value && (this.allInterests.indexOf(value) !== -1))
|
||||
if (value && (this.allInterests.indexOf(value) !== -1) && (!this.myInterests.includes(value)))
|
||||
{
|
||||
this.myInterests.push(value);
|
||||
event.chipInput!.clear();
|
||||
|
|
@ -75,7 +75,8 @@ export class InputInterestsProfilComponent implements OnInit
|
|||
|
||||
selected(event: MatAutocompleteSelectedEvent): void
|
||||
{
|
||||
this.myInterests.push(event.option.viewValue);
|
||||
const value = event.option.viewValue;
|
||||
if(!this.myInterests.includes(value))this.myInterests.push(value);
|
||||
this.tagInput.nativeElement.value = '';
|
||||
this.formControl.setValue(null);
|
||||
this.eventEmitter.emit(this.myInterests);
|
||||
|
|
|
|||
Reference in a new issue