onclick event in angular
(click)="myClickFunction($event)"
onclick event in angular
(click)="myClickFunction($event)"
angular click event
<button (click)="FunctionName()">TEST</button>
button click event listener angular
content_copy
import { HostListener, Component } from "@angular/core";
@Component({
selector: 'app',
template: `<h1>Hello, you have pressed keys {{counter}} number of times!</h1> Press any key to
increment the counter.
<button (click)="resetCounter()">Reset Counter</button>`
})
class AppComponent {
counter = 0;
@HostListener('window:keydown', ['$event'])
handleKeyDown(event: KeyboardEvent) {
this.counter++;
}
resetCounter() {
this.counter = 0;
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us