I am looping through an array of objects where each object contains another array of objects with attributes like "name" and "id". The length of this array of objects (noticias) varies.
I am struggling to display these values and have only managed to access and display them by hardcoding the "X" as shown below.
<div *ngFor="let c of DATA; let i = index;">
{{i}}{{c.name}}
<div *ngFor="let novedad of DATA; let i2 = index; ">
<div *ngIf="i2 === i">
{{novedad.noticias[0][X].name | json}} --> HERE
</div>
</div>
</div>
The DATA array is generated by a service that makes a series of HTTP calls to form this array.
Is there a way to loop through and display the values like
{{novedad.noticias[0][LOOP THROUGH THE LENGTH OF EACH OBJECT].name | json}}
?
I hope my question is clear. Thank you in advance!
JSON object:
[
{
"id": 6,
"name": "Encantamientos",
"forumid": 6,
"courseid": 6,
"type": "news",
"noticias": [
"Este curso no tiene novedades"
]
},
{
"id": 5,
"name": "Historia de la magia",
"forumid": 5,
"courseid": 5,
"type": "news",
"noticias": [
[
{
"id": 9,
"name": "aviso 1",
"groupid": -1,
"timemodified": 1585598111,
"usermodified": 3,
...
}
]
]
},
{
"id": 2,
"name": "Difusión ",
"forumid": 1,
"courseid": 2,
"type": "news",
"noticias": [
[
{
"id": 8,
"name": "tema difusin 3",
"groupid": -1,
"timemodified": 1585595618,
"usermodified": 3,
...
},
...
]
]
},
{
"id": 4,
"name": "Quimica",
"forumid": 3,
"courseid": 4,
"type": "news",
"noticias": [
[
{
"id": 7,
"name": "aviso quimica 3",
"groupid": -1,
"timemodified": 1585324962,
"usermodified": 3,
...
},
...
]
]
}
]