⊗jsagPmLpHP 38 of 97 menu

Event handler parameters in Angular template

You can pass parameters to event handler methods. Let's pass a string, for example:

<button (click)="show('test')"> button </button>

In the component class method, we set the parameter, indicating its string type:

export class AppComponent { public show(arg: string): void { alert(arg); } }

When you click the button, pass two numbers as a method parameter. In the method, output the sum of these numbers to the console.

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