<ng-container *ngFor="let item of arr1; let index = index">
<p [class.active]="isActive[index]" (click)="toggleClass(index)">
{{ item }}
</p>
</ng-container>
<ng-container *ngFor="let item of arr2; let index = index">
<p
[class.active]="isActive[arr1.length + index]"
(click)="toggleClass(arr1.length + index)"
>
{{ item }}
</p>
</ng-container>
isActive: boolean[] = [];
toggleClass(index: number) {
this.isActive[index] = !this.isActive[index];
}