Solve the Problem of ionic and angular pulling and loading, ionicangular
When it comes to ionic pulling and loading, it is the same as pc paging. It needs to be added at the bottom of the html data list.
<ion-infinite-scroll ng-if="hasmore" on-infinite="loadMore()" distance="10%"> </ion-infinite-scroll>
When the list is empty and ng-if is true, when the list is not filled up, loadMore () is automatically loaded ();
<Span style = "font-size: 18px;"> $ scope. loadMore = function () {Msdk. postJSON ('/informNotice/queryNoticeInfo', {pageIndex: $ scope. newsList. pageIndex, pageSize: $ scope. newsList. pageSize, informIds: $ scope. newsList. informIds}, function (e) {if (e. length! = 0) {// concatenate the data in each request. var a = $ scope. notice; $ scope. notice =. concat (e); console. log ($ scope. notice); // the loading of the previous broadcast ends, with conditions for loading $ scope. $ broadcast ('scroll. infiniteScrollComplete '); $ scope. newsList. pageIndex ++; </span>
<Span style = "font-size: 18px;"> // if the requested data is smaller than pageSize, no data is readable. </span> <span style = "font-size: 18px; "> <span style =" white-space: pre "> </span> // if (e. length <$ scope. newsList. pageSize) {$ scope. hasmore = false;} else {</span> [javascript] view plain copy <span style = "font-size: 18px;"> <span style = "white-space: pre "> </span> // if the value is true, perform the next pull Operation on $ scope. hasmore = true ;}} else {$ scope. hasmore = false; $ scope. $ broadcast ('scroll. infiniteScrollComplete ') ;}}</span>
Summary
The above section describes how to solve the problem of ionic and angular pull loading. I hope it will help you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!