objectKeys

Source objectKeys

Transforms an object into an array, to easily *ngFor repeat for an object

Example

  • typescript
this.listObj = {
  a: {
    name: 'a123'
  },
  b: {
    name: 'b123'
  },
  c: {
    name: 'c123'
  }
}
<div *ngFor="let key of listObj | objectKeys">
  {{ key }}
</div>

will render: a, b, c