button click event listener angular
(click)="myClickFunction($event)"
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;
}
}
Also in JavaScript:
- how to get json file in javascript
- javascript on hover
- python json dump
- node list files in directory
- acces store from vue console javascript
- optional arguments javascript
- drupal tag filter ajax content
- generating component in angular without spec file
- puppeteer example multiple file upload
- usereduce
- running scripts is disabled on this system react js
- cre&atRefs react js
- unexpected token react native stack navigation
- how to remove backslash from string in javascript
- javascript check if element is visible on screen
- react select with custom option
- js fill string with n characters
- javascript get same elments from multiple arrays
- scroll to top
- java.lang.IllegalArgumentException: Can only download HTTP/HTTPS
- rngesturehandlermodule.default.direction react native
- react js http post 500 internal server error
- datatable processing
- javascript object first key