- List item:
jsonObject = [
{
place: 'place1',
fatherDetails: [
{name: 'place1_father1', adharId: 134567},
{name: 'place1_father2', adharId: 124567},
],
motherDetails: [
{name: 'place1_mother1', adharId: 123456},
{name: 'place1_mother2', adharId: 123457},
{name: 'place1_mother3', adharId: 123467},
],
},
{
place: 'place2',
fatherDetails: [
{name: 'place2_father1', adharId: 123567},
{name: 'place2_father2', adharId: 12567},
],
motherDetails: [
{name: 'place2_mother1', adharId: 1234567},
{name: 'place2_mother2', adharId: 1234567},
{name: 'place2_mother3', adharId: 1234567},
],
}
];
I am trying to figure out how to use ngFor in HTML to loop through all the fatherDetails
objects. Here's what I have attempted:
<mat-option *ngFor = "let father of jsonObject">
{{father.name}}
</mat-option>
Unfortunately, this code isn't working as intended because it needs to iterate twice for proper looping.