OnScroll Event not firing inside a mat-drawer-container

383 views Asked by At

I have a bunch of content inside of a mat-drawer-container and I would like to listen for scroll events on it. I have tried window.onscroll() and it did not work. I removed the mat-drawer-container and window.onscroll() worked. I think the mat-drawer-container is the issue.

1

There are 1 answers

0
Dovi Rosner On BEST ANSWER

It should work if you listen to the scroll event on the mat-drawer-content class.

document.getElementsByClassName('mat-drawer-content').item(0)!.addEventListener('scroll', () => {
    console.log('It works!')
  })