Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Manipulating one source list for several dropdowns

In an Angular App I am trying to create selection lists (or maybe dropdowns) which shall all have the same source list. When an item is selected in any of the dropdowns, it should not be available anymore in the source list. So when any of the other dropdowns is opened, this item should not be available for selection anymore.

I have tried so solve this with primeng multiselects and also with simple select and option tags. But every time the problem seems to be the manipulating of the source list. When I remove the item from the source list, the select tag seems kind of to lose the source list and there are no options at all.

I think, what I'm getting wrong, is the filtering ... Here is the code:

<table id="clusters">
<tr *ngFor="let cluster of someService.clustersList; let i = index">
    <input type="text" [value]="cluster.desc">
    <p-multiSelect [options]="someService.sourceList" [(ngModel)]="cluster.items"
        (onChange)="editClusterGroups($event, i)" defaultLabel="Select groups" optionLabel="desc">
    </p-multiSelect>
</tr>
public editClusterGroups(event, i) {

this.someService.sourceList = this.someService.sourceList.filter((el) => {
    if (this.someService.clustersList[i].items.some((item) => item.code !== el.code)) {
        return true
    }
})

}

Got it figured out at least with the filtering. This way it works:

public editClusterGroups(event) {
  this.someService.sourceList = this.someService.sourceList.filter((el) => el.code !== event.itemValue.code) }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!