I'm trying to show a list of informations from an XML to a list using Angular 4 and Angular Material. I have already converted the XML to JSON and the JSON I retrieve is like this:
{
"json": {
"0": [{
"Name": "John",
"Address": "5th street",
"Phone": "555-123-456"
}
],
"1": [{
"Name": "Mary",
"Address": "4th street",
"Phone": "555-654-321"
}
],
"2": [{
"Name": "Harry",
"Address": "3th street",
"Phone": "555-124-231"
}
]
}
}
this is my ts file: [i] is the id and id has dozens of entries.
for (let i = 0; i< json.length; i++){
this.name = json[i]['Name'];
this.address = json[i]['Address'];
this.phone = json[i]['Phone'];
}
this is my html file:
<mat-list>
<h3 mat-subheader>Your info</h3>
<mat-list-item>
<h2 mat-line>Your name is: <b>{{name}}</b></h2>
<p mat-line> Your address is: <b> {{address}} </b></p>
<p mat-line> Your phone is: <b> {{phone}} </b></p>
</mat-list-item>
<mat-divider></mat-divider>
</mat-list>
The thing is, the list has dozens of rows but it is showing the first only.
My intention was to have all the items loaded on page.
Already tried using *ngFor but it didn't work.
I know I might have missed something stupid but I've tried a lot and searched a lot but couldn't find a solution.
Thanks in advance

[i]['Name']