⊗jsagPmLpOEP 40 of 97 menu

Event object and parameters in Angular template

You can combine the $event variable with other parameters. The order does not matter - Angular will insert the event object into the parameter where $event is written.

Let's look at an example. We'll pass a string and an object with an event as parameters:

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

Let's catch what was passed in the parameters of the component class method:

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

Catch the passed parameters in variables:

<button (click)="show('eee', 123, $event)"> button </button>
enru