A
A
andrkkk2020-05-15 18:50:48
Angular
andrkkk, 2020-05-15 18:50:48

Is it possible to do double nesting when passing value from component to html?

There is the following code:

<tr *ngFor="let col of allColumns">
    <div *ngIf="isChecked(col)==false">
        <th>{{col.name}}:</th>
        <tr></tr
</tr>

If the user has removed a column from the table (i.e. the checkbox is not set to isChecked(col)==false), then the column is needed and its value must be hidden in another part. I want to display all hidden columns and corresponding values.
The problem is that the column array is separate and the value array is separate.
Col looks like this:
ALLCOLUMNS:[
    { 
        name: 'Название',
        prop: 'title'
    },
    ...

By "prop" you can just get the value from another row array, which just contains the values ​​of a particular object.
You need to do something like this:
<tr *ngFor="let col of allColumns">
    <div *ngIf="isChecked(col)==false">
        <th>{{col.name}}:</th>
        <tr>{{ row.{{col.prop}} }}</tr
</tr>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question