Home passing variable from ngfor to another ngfor not in the same element
Reply: 0

passing variable from ngfor to another ngfor not in the same element

Ghaith Briki
1#
Ghaith Briki Published in 2018-02-14 09:06:33Z

Please help me, I'm on angular 4. I want to pass the soustory variable from the second loop to the third loop so I can list the rest of the data on a separate row.

<div class="row">
  <ng-container *ngFor="let story of strlist;">
    <div class="col">
      {{story.title}}
      <div class="row">
        <div class="col" *ngFor="let soustory of story.sous">
          {{soustory.title}}
        </div>
      </div>
    </div>
  </ng-container>
</div>
<hr>
<div class="row">
  <div class="col" *ngFor="let s of soustory.third">
    {{s.title}}
  </div>
</div>

below the data arrays (

 [
      // story principale 1
      {
        id: 1, title: 'A1', description: 'doing',
        // sous story niveau 2
        sous: [
          {
            id: 1, title: 'T1', description: 'doing',
            // third story niveau 3
            third: [{ id: 3, title: ' S1', description: 'kyrie irving' },
            { id: 3, title: ' S2', description: 'lebron james' }]
          },
          // sous story niveau 2
          {
            id: 2, title: 'T2', description: 'ready',
            // third story niveau 3
            third: [{ id: 3, title: 'S3', description: 'giannis' }, { id: 3, title: 'S4', description: 'giannis' }]
          },
          // sous story niveau 2
          { id: 3, title: 'T3', description: 'done' }]
      },



    ];

But nothing goes there.

can someone help me please

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.320765 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO