无法在离子中动态生成10个以上的幻灯片

时间:2017-02-15 07:08:45

标签: angularjs ionic-framework ion-slides

我有一个包含50个对象的数组,我试图从每个数组中获取数据并将其显示在离子幻灯片中

<ion-content scroll="false">
        <ion-scroll direction='y'>
            <ion-slide-box show-pager="false" ng-repeat="result in data| limitTo:1">
                <ion-slide class="slider-class" ng-repeat="result in data">
                    <!--my data -->               
                </ion-slide>
            </ion-slide-box>
        </ion-scroll>

我已经尝试仅将ng-repeat应用于<ion-slide>,但它不起作用。所以不得不像这样使用ng-repeat

我创建一个空数组并一次将10个数据推送到数组5次。 enter image description here

$http.get(apiURL)
      .then(function(response){
        var array = new Array();
        array.push(response.data.results);
        for(var i=2;i<=5;i++){
          $http.get(apiURL+'/?page='+i)
          .then(function(response){
            for(var i=0;i<=9;i++){
              array[0].push(response.data.results[i]);
            }
          })
        }
        $scope.data= array[0];
    });

response.data.results是一个包含10个对象的数组,它们存储在数组的第0个索引中。所以我每次都要再将10个对象推到第0个索引。

0 个答案:

没有答案