Skip to content
Advertisement

Angular – Scroll Event only page scroll

I need to check scroll event for a “show more” features.

Im using:

JavaScript

and this code:

JavaScript

Unfortunally the scroll listen to every scroll in page, for example a scroll inside a DropDown etc…

How can I listen ONLY the PAGE scroll ignoring everyelse?

Advertisement

Answer

One solution might be to use hostListener from Angular (https://angular.io/api/core/HostListener) in your page component

JavaScript

or you could use something like that

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement