Material angular infinite scroll with $http request

后端 未结 3 1143
轮回少年
轮回少年 2021-01-05 17:20

I\'m using md-virtual-repeat directive of Angular Material to have an infinite scroll, and I need to replace it\'s demo $timeout function with a $h

3条回答
  •  失恋的感觉
    2021-01-05 18:09

    On every api call try to get wheather the db has few more records or not. and add that condition in fetchMoreItems_ function.

    fetchMoreItems_: function (index) {
                  if (this.toLoad_ < index && hasMoreRecords) {
                      this.toLoad_ += 5;
    

    In our code we get the details like

    • sCurrentPage : 3
    • sMore: true ==>>this indicates that the db has more records or not after fetching page wise data.
    • sTotalPages: 4
    • sTotalRecords : 36

提交回复
热议问题