AngularJS Scroll to the bottom level after changing the scope of change / change of resource

I am currently trying to do this with $ anchorScroll

But I do not know where to place

<a id="bottom">

currently my mind <table>and I'm on a <tr>. I then $watchfor the area changes and apply them to ng-repeat.

HTML:

<tr ng-repeat="document in documents.items">
    <td>{{document.subject}}</td>
    <td>{{document.course}}</td>
    <td>{{document.bundle}}</td>
    <td>{{document.lesson}}</td>
    <td>{{document.category}}</td>
    <td>{{document.name}}</td>
</tr>

Code in my controller:

$scope.$watchCollection('search', function (newData, oldData) {
    if (newData != null) {
        $scope.documents = Document.query(newData)
        console.log(newData);
    }

Now I tried to put $location.hash, and $anchorScrollafter $scope.documents, but nothing happened.

A question was also asked: Should I put the paging function in directive, or should I do it with<div ng-click="nextPage()">

+4
source share
1 answer

, , setTimeout - , , , !

: ng-repeat: do setTimeout(() => { /* Your scroll stuff here */ }, 0); to

+1

All Articles