将flex滑块用于角度,但想要根据元素单击外部flex ng-repeat选择特定幻灯片。作者给出了两种方法,即 addRandomSlide和removeRandomSlide但不能选择特定的幻灯片。在jquery中它很容易但有角度但尚未找到解决方案。
这是HTML代码......
<flex-slider
slide="s in slideshow.slides track by $index"
animation="slide" >
<li >
<img ng-src="{{s}}">
</li>
</flex-slider>
这是javascript代码......
$scope.slideshow.slides = [
'images/mobile/banners/banner1.png',
'images/mobile/banners/banner2.png',
'images/mobile/banners/banner-5.png',
'images/mobile/banners/banner-6.png'
];
$scope.addRandomSlide = function () {
$scope.slideshow.slides.push('http://lorempixel.com/704/444/cats');
};
$scope.removeRandomSlide = function () {
$scope.slideshow.slides.shift();
};