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

212
Views
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 answers
Answer question

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 Report
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!