Html
<button (click)="myClickFunction($event)">
Click Me
</button>
app.component.ts
myClickFunction(event) {
//just added console.log which will display the event details
console.log('inside myClickFunction');
}
When I click on the button (named click me) multiple times, the console.log is printing multiple times. How to make it call only the first time irrespective of number of clicks?
I have tried event.preventdefault(), but getting following error:
Cannot read property 'preventDefault' of undefined
Any suggestion will be appreciated.