How can i bind function onclick / (click)
inside template literal.
For Example:
for (let i = 0; i < locations.length; i++) {
let customHtml = `
<div class="flex">
<ion-button size="small" (click)="${abc(locations[i])}">Message</ion-button>
<ion-button size="small" onclick="abc('${locations[i]}')">Request</ion-button>
</div>
`;
}
abc(l){
console.log(l);
}
on 1st button is it getting logged at the time of loading. Not on clicking.
on 2nd button it is showing error: Uncaught ReferenceError: abc is not defined
.
i have Tried both way vanilla Javascript and in Angular way to bind functions on click events.