Reputation: 1575
I have a div inside another div where the outer div has a height less than the contents.
the first content has a scroll event
<div style="overflow:auto;height:200px">
<div (scroll)="scrollHandler($event)">Hello {{name}}</div>
.... Other content elements.
but this scroll event is not working. please note that I want to trigger scroll event on the element, not on the window.
I have a plunkr here
https://plnkr.co/edit/Ib0fxBIb7syGdEtQ1Rz4
Upvotes: 1
Views: 1446
Reputation: 73761
The scroll event handler should be on the outer div, the one that has the scrollbar:
<div style="overflow:auto; height:200px" (scroll)="scrollHandler($event)">
<div>Hello {{name}}</div>
...
</div>
You can test this modified plunker (check the console, I removed the alert calls).
Upvotes: 3