Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda