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

113
Visualizações
How to make a new Array of Object using data from backend which is array of objects?

Hi I am new to Angular and I want to bind my dropdown options with value as

[ { label: "name", value: "id"} ]

as in label should have the below names and the values as the below IDs ( in the image )

I have my backend data as

enter image description here

I want the id and name as my options value for the dropdown. Please if anyone could guide me

p.s I tried using map function but all I am getting in the options is [object object]

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should use the map function

backendData.map(item => ({ label: item.name, value: item.id }));

The map function returns a newly created array, that is containing the mapped objects.

Here is a small mvp stackblitz: Stackblitz

about 4 years ago · Juan Pablo Isaza Relatório
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