I have a button that should call a function fun() . For some reason, the event is not working at all. Here is the code: TS File:
fun(): void {
this.test = 'You are my hero!';
alert('hello')
}
And the HTML:
<button type="button" (click)="fun()">Click me!</button>
I have no idea what I am doing wrong Please help me.
2
Answers
Try this out,
Button click
Your code seems to be working fine. If you have trouble working refer the working stackblitz below.
Check this working code sample:
app.component.ts :
app.component.html: