Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda