# Handy key filtering in Angular templates

Learned this one from Minko over at twitter.

(keydown.escape)="onEscapeDoSomething()"

Did some quick checks and it seems the listener is scoped to the DOM-level it is introduced. Meaning focus should be on the element that has the event listener or one of its children for it to work.

Super handy for those tiny interaction and accessability behaviour improvements.

And whaddaya know – you can chain keys for key combos 🤗 Thanks to Juliano for pointing that out.

(keydown.control.i)="displayInfo()"
Last updated: April 19th 2019