var cities = [{id: 1, name: "London"}, {id:2, name="manchester"}]
var areas = [{name="Buckingham palace", cityId: 1}, {name:"Wembley", cityId:1}, {name:"Media City", cityId: 2}, {name:"Old Trafford", cityId:2}]
How can I make a list appear like so:
London
Buckingham palace
Wembley
Manchester
Media City
Old Trafford
So far I have:
<ion-list>
<ion-item *ngFor="let category of categories">
{{category.name}}
</ion-item>
<ion-list>
<ion-item *ngFor="let area of areas"> ### HERE: Where area.id == category.id
{{area.name}}
</ion-item>
</ion-list>
</ion-list>
I seem to get stuck matching the items, and researching shows no real clear way to do this. It's not good to flatten the data either as other items are appended later.
Any thoughts or best practices on nested loops matched by id's?