any idea guys why is that the click is not triggering inside the ngFor? I tried adding console log and it does not even fire. Thanks.
#html code
<ng-container *ngFor="let store of getLocationIds()">
<a onclick="alert('clicked')" style="cursor: pointer;">Test Link</a>
<a (click)="redirectToUrl(store.url)" class="location-link" style="cursor: pointer;">{{ store.locationId }}</a>
<ng-container *ngIf="store !== getLocationIds()[getLocationIds().length - 1]">, </ng-container>
</ng-container>
getLocationIds(): { locationId: string, url: string }[] {
const stores = this.nonRetailProperty?.nonRetailAssociatedStores || [];
return stores.map(store => ({
locationId: store.locationId,
url: store.url
}));
}
redirectToUrl(url: string): void {
console.log('1234', url)
window.open(url, '_blank');
}