Skip to content

scroll goes too soon #38

Description

@Kukunin

Hello here. I'm trying to use this directive for my case, and it seems it doesn't work properly.

I have scrollable div, with AJAX messages there. So, I expect, that after message is added, container will scroll down for it. But, it doesn't work.

My inverstigations:

$window.addEventListener('resize', scrollIfGlued, false); doesn't call the callback. Callback is called from scope.$watch(scrollIfGlued); immediately after AJAX query done (it's noticeable from stacktrace), and scroll function is called too early, when el.scrollHeight isn't enought high.

The solution is

scope.$watch(function() {                                   
  $timeout(scrollIfGlued, 0, false);                                  
}); 

I'd commit pull request, but test fails for me, and I can't repair them.

I understand, it sounds like edge case, but it will make directive more robust

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions