How to perform search inside a nested loop of data
<span *ngFor="let like of post.likes" >
<ion-icon name="heart" class="icons-heart" *ngIf="like.likedBy._id == userId; else elsehae" (click)="unLikePost(post._id, like._id)"> </ion-icon>
<ion-icon name="heart-empty" class="icons" *ngIf="!like.likedBy._id == userId" (click)="addLike(post._id)"></ion-icon>
</span>
the problem with this is if there are n number of post.likes
it will iterate for number of times and also the else statement is printed n number of times.
I am unable to perform *ngIf=(post.likes(x => x.likedBy._id == matchId))
what is the possible solution for this problem.