Save index to reuse

1

Hello, my problem is that I need to print a sublist that goes in a tr apart below the tr where I loop (in the ng-container), but once out of that tr (where I do the loop) the i no longer recognizes me. Any ideas?. Thank you very much

<table class="procedures-table__grid">
    <caption class="sr-only"><h3>Select next procedure</h3></caption>
    <thead class="procedures-table__grid__header">
      <tr>
        <th id="procedure_procedure" class="">Trámite</th>
        <th id="procedure_regulatory-reform" class="">Reforma normativa</th>
        <th id="procedure_options" class=""></th>
      </tr>
    </thead>
    <tbody>
      <tr [indicator] = i *ngFor="let procedure of tableListProcedures, index as i">
        <td headers="procedure-procedure">
          <button (click)="openCloseTab(i);" class="">
            {{procedure.procedureName}}
          </button>
          <!-- <i class="adriano-arrow-down" attr.aria-hidden=""></i> -->
        </td>
        <td headers="procedure_regulatory-reform">
          <a (click)="goReformProcedure();" href="#" class="">
            {{procedure.regulatory_reform_Procedure}}
          </a>
        </td>
      </tr>
      <ng-container *ngIf="i">

      </ng-container>
    </tbody>
  </table
    
asked by beaag58 08.11.2018 в 09:44
source

1 answer

2

You can group within an ng-template tag:

  <tbody>
    <ng-template *ngFor="let procedure of tableListProcedures, index as i">
      <tr [indicator] = "i" >
        <td headers="procedure-procedure">
          <button (click)="openCloseTab(i);" class="">
            {{procedure.procedureName}}
          </button>
          <!-- <i class="adriano-arrow-down" attr.aria-hidden=""></i> -->
        </td>
        <td headers="procedure_regulatory-reform">
          <a (click)="goReformProcedure();" href="#" class="">
            {{procedure.regulatory_reform_Procedure}}
          </a>
        </td>
      </tr>
      <ng-container *ngIf="i">
        ... 
        ¿¿¿ <tr *ngFor="let subprocedure of procedure.subprocedures"> ???
      </ng-container>
    </ng-template>
  </tbody>
    
answered by 08.11.2018 / 10:18
source