How to compare items in <ng-select> with another array to get only unique items in the select options

Viewed 86

i would like to know how u can use ng-select to only show items which aren't in the array the user is trying to add to (unique in comparison with the other array). This is an example:

<ng-select
   *ngIf="!value"
   [(ngModel)]="this.arrayOfSelectedItems[rowIndex]"
   [items]="this.arrayOfAllPotentialItems()"
   appendTo="body"
  (change)="this.refreshRows()
>
   <ng-template ng-option-tmp let-item="item">
       {{item.name}}
   </ng-template>
</ng-select>

When trying to use a function in the [items] input to compare and filter the unique items it shows the correct unique items, but i'm unable to make a selection.

Could anyone help me out?

0 Answers
Related