方向为y的离子滚动在离子1中不起作用

时间:2019-02-06 08:03:31

标签: angularjs ionic-framework

查看代码:

    <ion-view class="forms-view" ng-init="loadall()">
          <ion-nav-buttons side="left">
            <button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
          </ion-nav-buttons>
          <ion-nav-title>
            <span>List</span>
          </ion-nav-title>
          <ion-content>
            <ion-scroll direction="xy" on-scroll="addMoreItem()">
                 <ion-list ng-controller="card">

                        <div class="item item-input-inset">
                            <label class="item-input-wrapper">
                                <i class="icon ion-search placeholder-icon"></i>
                                <input type="text" ng-model="input.filterUser" placeholder="Search" style="height:48px;">
                            </label>
                        </div>

                      <ion-item class="item-avatar item-icon-right" ng-repeat="cardlists in cardlist | filter:input.filterUser" ui-sref="app.details({card_id:cardlists.card_id,xyz:0})">

                        <img src="{{cardlists.avatar}}" >       
                        <h2>{{cardlists.name}}</h2>
                        <p>{{cardlists.card_id}} </p>

                        <i class="icon ion-plus-round custom-icon" ng-show="!cardlists.isShow" ng-click="addTo(cardlists.card_id);cardlists.isShow = true"></i> 
                        <i class="icon ion-checkmark-round" ng-show="cardlists.isShow"></i>
                      </ion-item> 
                   </ion-list>
            </ion-scroll>

          </ion-content>
        </ion-view>

    controller code:
    controller('boardCtrl', function ($scope, $http, $cordovaSQLite, $localStorage, $state,$rootScope,$ionicPlatform,$ionicPopup,$timeout,$filter,$ionicNavBarDelegate) {
$rootScope.limit_list=10;
$scope.addMoreItem=function()
                {
                if($scope.cardlist.length >= $rootScope.limit_list)
                    {
                        $rootScope.limit_list+=5;
                    }
                    $scope.loadall();
                }
                $scope.loadall=function()
                {

                    $rootScope.cardlist = [];

                    var query2 = "SELECT * FROM abc  LIMIT "+$rootScope.limit_list;
                    $cordovaSQLite.execute(db, query2, []).then(function (res) {
                        if (res.rows.length > 0) {
                            for (var j = 0; j < res.rows.length; j++) {
                                var name = res.rows.item(j).name;

                                        $rootScope.cardlist.push({
                                            name: name,
                                            age: res.rows.item(j).age,
                                            card_id: res.rows.item(j).card_id,
                                            avatar: "img/avatar5.png"
                                        });
                }
                }
                }
                }
                }

我想在加载视图及其工作正常时显示一个列表。我要做的唯一更改是默认情况下仅显示10个名称,并且当我向下滚动页面时,我想再加载10个,依此类推上面的代码工作得很好,但只能在x方向即水平滚动。我希望它在向下滚动即垂直滚动时加载更多名称。任何人都可以告诉我上述代码有什么问题。这将是有帮助的。

0 个答案:

没有答案