By utilizing the data structure provided, you can accomplish this task with the help of the KeyValuePipe, along with nested *ngFor
loops. The KeyValuePipe
enables you to iterate through an object similar to using Object.entries
, giving you access to both a key
and a value
property for each item. In this scenario, the value
will be an array that can be iterated over using another *ngFor
:
<strong>Plate and year</strong>
<div *ngFor="let list of lists">
<div *ngFor="let car of list.cars | keyvalue">
<div>{{car.key}} - <div *ngFor="let year of car.value">{{year}}</div>
</div>
</div>
</div>
An interactive example showcasing this approach is available.
I hope this explanation proves helpful!