Can ngFor classify arrays?

suppose there is an array like this

[
    {eid: 1, name: aa},
    {eid: 1, name: bb},
    {eid: 2, name: cc},
    {eid: 1, name: dd},
    {eid: 3, name: ee},
    {eid: 1, name: ff},
    {eid: 2, name: gg}
]


if I want him to run ngFor

can this array be displayed according to eid classification?

the final result should be shown like this

1 aa
1 bb
1 dd
1 ff

2 cc
2 gg

3 ee

Mar.29,2022

data preprocessing and sorting.

arr.sort((c, n) => c.eid < n.eid ? -1 : c.eid > n.eid ? 1 : 0)

ngFor should only be rendered sequentially, and there is no way to change the DOM structure

Menu