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

183
Views
ng-select not displaying from array

I'm using an ng-select for a field in a table, and I'm looking to get values from an array to populate and allow individual selections.

Below is the code the is being logged correctly, but I'm having some difficulty to get it to display. Currently the drop-down is empty, but the console log is as expected with all the expected data.

    <ng-select [searchable]="false"
                bindValue="name"
                bindLabel="name"
                [items]="serviceUsersMedication"
                [(ngModel)]="serviceUsersMedication.name"
    >

    <ng-template ng-label-tmp let-item="item">
       {{item.name}}
    </ng-template>
   </ng-select>


    onSelect({selected}) {
     this.selected = selected;
     const filteredMeds = this.selected.filter(item => {
       return item.medications;
     });

     this.serviceUsersMedication = filteredMeds.map(item => {
       return item.medications;
     });

     console.log('Selected:');
     console.log(this.selected);

     console.log('Service users medication:');
     console.log(this.serviceUsersMedication);
    }

this.selected is a variable that stores an array of a user's information when selecting from a row.

this.serviceUsersMedication is a variable that holds their meds from the selection.

I'm looking to display the name field from the array in the dropdown.

Console log as expected

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!