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