Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗jsagPmLpOE 39 of 97 menu
◀ ▶

Event object in event handler in Angular template

In event handlers, you can get an object Event. To do this, you need to pass a special variable $event (with a dollar sign at the beginning) to the parameter of the bound method:

<button (click)="show($event)"> button </button>

Let's get the passed object in the class method:

export class AppComponent { public show(event: MouseEvent): void { console.log(event); } }

On click, get an object with an event and output it to the console.

Get the coordinates of the click on the screen.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline