在一个离子1应用中,我正在尝试使用
的几个图像幻灯片显示模态弹出式<ion-slide-box>
<ion-slide ng-repeat="post in popUpImages">
<img ng-src="{{post.url}}" class="fullscreen-image"/>
</ion-slide>
</ion-slide-box>
这很好地工作了,而弹出式显示在数组索引0上的图像首先显示。现在,我想在弹出窗口到来时从索引3处显示弹出映像数组的图像。任何人都帮助我。
在您的控制器注入以下指令$ionicSlideBoxDelegate
您还可以使用委托=> $ionicSlideBoxDelegate.currentIndex();
<ion-slide-box on-slide-changed="slideChanged($index)">
然后创建一个通过滑框电流幻灯片索引的function
。
添加事件以确定幻灯片是否更改执行以下操作:
$scope.showImage = false;
$scope.slideChanged = function (index) {
if(index===3) //$ionicSlideBoxDelegate.currentIndex() === 3
{
$scope.showImage = true;
//Show images
}
}
在标记中:
<img ng-show="showImage" ng-src="{{post.url}}" class="fullscreen-image"/> <!--can use ng-if="showImage" as well-->