Solve the Problem of ionic and angular pulling and loading, ionicangular

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.