Scroll up to Load More Data in angular1

I want to add scroll up to load more data in div. Please share any demo which is used. I want to implement it on message detail screen where user can scroll up to load more message.

1 answer

  • answered 2018-01-13 06:03 Tek chand choudhary

    Attach onscroll event handler on div first then use it like this:

    document.getElementById("myDIV").addEventListener("scroll", myFunction);
    
    function myFunction() {
        if (document.getElementById("myDIV").scrollTop === 0) {
          // call api to fetch data
        }
    }