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

214
Visualizações
How to use angular material select with string map

I am trying to use the angular material with a string map which is filled from my backend (works) it after getting filled it has the following values: {key: ..., value: ...} but my select stays empty if I click on it it does not show me any values to select from. Can someone from you look at it and tell me what is wrong?

This is my html (only select):

<mat-select formControlName="legitimiertGwg" multiple >
    <mat-option *ngFor="let person of personArray" [value]="person.key">{{person.value}}</mat-option>
  </mat-select>

This is my ts file (only map):

  personArray = new Map<string, number>();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have to tell Angular to get for...loop iterations as [key, value] pair by adding the pipe "keyvalue" like below:

<mat-select formControlName="legitimiertGwg" multiple >
    <mat-option *ngFor="let person of personArray | keyvalue" [value]="person.key"> 
        {{person.value}}
    </mat-option>
</mat-select>
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