+ 1
How can get name of children in array with angular Iuse ngfor and father name and child id but unable to get childern name
People = [{id : 1, name: "barun", children:[2]}, {id:2, name:"rahul", children:[3,4]},{id:3,name:"asif"},{id:4,name:"chetan"}] *ngFor ="let person of people" <> *ngFor = "let child of person.children" {{person.name}} and {{child}}
1 ответ
0
You can refer following code:
<div *ngFor="let item of People">
<ul >
<li>{{item.name}}</li>
<ul *ngFor="let obj of item.children">
{{obj}}
</ul>
</ul>
</div>