zoukankan      html  css  js  c++  java
  • ionic1 下拉刷新 上拉加载 功能

    html页面如下

     <ion-content>
        <ion-refresher pulling-text="刷新" on-refresh="search()"></ion-refresher>
        <!---首页内容-->
        <div>
          <ul>
            <li ng-repeat="position in positions">内容</li>
          </ul>
        </div>
        <!--首页内容结束-->
        <ion-infinite-scroll ng-if="searchModel.offset<=(positions.count-10)" on-infinite="loadMore()" distance="1%"></ion-infinite-scroll>
      </ion-content>

    js如下

    angular.module('app')
      .controller('IndexCtrl', function($scope, positionService) {
        $scope.searchModel = {
    offset: 0
    }
    //下拉刷新
    $scope.search = function(){
    $scope.searchModel.offset = 0;
    positionService.getPositions($scope.searchModel)
    .then(function(response){
    $scope.positions = response.data;
    },function(error){
    })
    }
    //上拉加载
    $scope.loadMore = function(){
    $scope.searchModel.offset += 10;
           positionService.getPositions($scope.searchModel)
    .then(function(response){
    $scope.positions = $scope.positions.concat(response.data);
    },function(error){
    })

    }
     })

    具体用法参考   http://www.ionic.wang/js_doc-index-id-25.html      http://www.ionic.wang/js_doc-index-id-29.html

  • 相关阅读:
    mybatis设置select返回HashMap,字段值为null时,不会保存key
    copyProperties 忽略null值字段
    动态新增表单
    页面时时刷新数据
    FormData 传List对象集合到后台
    linux常用命令总结
    Linux部署安装JDK
    yum安装nginx
    01_Python基础
    Nginx防盗链
  • 原文地址:https://www.cnblogs.com/luffyc/p/7218016.html
Copyright © 2011-2022 走看看