I have a scenario where I need to create a tag from TS and i need to capture the click event if someone click on tag
In Html
<p [innerHtml]="textField"></p>
<button (click)="generateLink()">click</button>
In Ts
textField = 'Hello click button for link';
generateLink() {
this.textField = `${this.textField} <a href="#" onclick="update()">click me</a>`;
}
update(){
console.log('click me is clicked')
}
Here whenever click me is click I need to trigger update method. link to stackblitz link
Please anyone let me know how to achieve it.Thanks