title: Angular how to pass array in to component
body: <p>How do I pass an array from template to component file. I have an <code>if</code> condition which is dependent on the index of the loop. Please help me to find the right approach. Something like this 
  <a href="https://jsfiddle.net/HB7LU/7638" rel="nofollow noreferrer">https://jsfiddle.net/HB7LU/7638</a> </p>
  
  <pre><code>&lt;ul&gt;
    &lt;li *ngFor="let data of list_value | keyvalue; let i=index;" (click)="getListValue(i,data)"&gt;
    &lt;li&gt;
    &lt;ul&gt;
       &lt;li *ngFor="let item of data.value" *ngIf="data[i].active"&gt;
       &lt;li&gt;
    &lt;ul&gt;
  &lt;ul&gt;
  </code></pre>
  
  <p>example.componet.ts file</p>
  
  <pre><code>export class SomeComponent{
  
     list_value: Array&lt;any&gt; = [];
     active: boolean;
  
     getListValue(index: String, data: any) {
         console.log("Test",data[index]);
         list_value[index].active = !list_value[index].active
     }
  }
  </code></pre>