click

  1. <li *ngFor="let hero of heroes" (click)="onSelect(hero)">

鼠标事件

鼠标按下

  1. @HostListener('document:mousedown', ['$event'])
  2. onDocumentMouseUp(evt: MouseEvent) {
  3. }

鼠标移动

  1. @HostListener('document:mousemove', ['$event'])
  2. onDocumentMouseUp(evt: MouseEvent) {
  3. }

鼠标抬起

  1. @HostListener('document:mouseup', ['$event'])
  2. onDocumentMouseUp(evt: MouseEvent) {
  3. }

window事件

resize

  1. @HostListener('window:resize', ['$event'])
  2. onWindowResize(evt) {
  3. }
文档更新时间: 2019-12-25 11:07   作者:admin