Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular combine 2 output events to call 1 function

Tags:

html

angular

I would like to know if it is possible in Angular 4 to have two ouput events calling 1 function?

e.g.

<input type="button" value="send" (click, keydown.enter)="doMagic()"/>

instead of doing

<input type="button" value="send" (click)="doMagic()" (keydown.enter)="doMagic()"/>

@HostListener is not an option.

Thanks for your help!

like image 535
WorstCoderEver Avatar asked Feb 11 '26 18:02

WorstCoderEver


1 Answers

It doesn't seem so - at least not from this issue asking for it as a feature: https://github.com/angular/angular/issues/6675

like image 183
match Avatar answered Feb 13 '26 09:02

match