I am trying to access from an html through a variable to the property of an object that has several levels something similar to the following:
Variable named rows
[
{
name: "Row1",
levels: {
name:"name1",
things: {
name: "thing1"
}
}
},
{
name: "Row2",
levels: {
name:"name2",
things: {
name: "thing2"
}
}
}
]
Variable named columns
[
{
id:"col1",
properties:"name"
},
{
id:"col2",
properties:"levels.name"
},
{
id:"col1",
properties:"levels.thing.name"
}
]
HTML
<div *ngFor="let row of rows ">
<div *ngFor="let col of columns">
{{ row[col.properties] }}
</div>
</div>
HTML result
Row1
undefined
undefined
Row2
undefined
undefined
The problem is that there will not always be the same number of sublevels since it is for a common component, the levels and the organization are passed by the "Columns" variable.
In the previous code the values of the first level are shown, but the The rest is not, it shows them as undefined since it does not access the internal object.