0

I code an infinite scrolled DIV for an AngularJS bootstrap app, as shown in the following example.

When Scrolled Fiddle

angular.module('scroll', []).directive('whenScrolled', function() {
return function(scope, elm, attr) {
    var raw = elm[0];

    elm.bind('scroll', function() {
        if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
            scope.$apply(attr.whenScrolled);
        }
    });
};

});

Data is loaded but the scroll of the DIV goes to bottom and to see the data loaded you need to scroll up again. How do I fix this?

View Image

2
  • How are you implementing this? Can I see the view? Commented Jul 9, 2017 at 23:50
  • I add an image, I have a panel that work with ng-repeat Commented Jul 10, 2017 at 0:49

2 Answers 2

0

Does the div with ng-repeat have id="fixed", along with the following CSS?

#fixed {
    height: 400px;
    overflow: auto;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Yes the div have both CSS styles.
0

I found the problem, the data I received replace all the array, I code using push into the ng-repeat array.

array.push (tempArray[i])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.