Home  >  Article  >  Backend Development  >  javascript - How to load more lists on click in angularJS! as the picture shows!

javascript - How to load more lists on click in angularJS! as the picture shows!

WBOY
WBOYOriginal
2016-09-21 14:13:081045browse

javascript - How to load more lists on click in angularJS! as the picture shows!
javascript - How to load more lists on click in angularJS! as the picture shows!

When I click the load button, I don’t know how to loop through page and pagesize’s ng-repeat to the page!

Reply content:

javascript - How to load more lists on click in angularJS! as the picture shows!
javascript - How to load more lists on click in angularJS! as the picture shows!

When I click the load button, I don’t know how to loop through page and pagesize’s ng-repeat to the page!

You need to use conact to connect the data obtained after clicking to load more. pageIndex current page pageSize page number totalNumber are passed from the background.

`
//The following is written in the callback success of the request backend interface
$scope.data= $scope.data.concat(data.data);

`

Set the default current pageIndex to 1

The length of the pulled data defaults to the number of pages set by pageSize

Click the load button pageindex+1, and then call the interface to get the data

The process is roughly like this

I won’t go into details about the number of pages and some judgments

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn