DEV Community

Discussion on: Nobody has to use HostListener

bespunky profile image
Shy Agam

It is probably better to use Renderer2 for listening instead of directly accessing the native element.

tieppt profile image
Tiep Phan

I think so. Renderer2 have listen method to do that.

niklas_wortmann profile image
Jan-Niklas Wortmann Author

Oh thanks a lot for this feedback. I didn't know that before. I'll update the blog post today

agroupp profile image
Arthur Groupp

Renderer2 listen method doesn't have params that have addEventListener. Actually it's the same as @HostListener.