How can I use ngFor to iterate over Typescript Enum as an array of strings

You can just use the “keyvalue” pipe introduced in Angular 6.1.

<p *ngFor="let enum of TestEnum | keyvalue">
  {{ enum.key }} - {{ enum.value}}
</p>

See here for a full example ->
https://stackblitz.com/edit/angular-gujg2e

Leave a Comment