我有一个包含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
。
$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个索引。