Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在有角度的ui boostrap旋转木马上读取活动幻灯片_Javascript_Jquery_Angularjs_Twitter Bootstrap - Fatal编程技术网

Javascript 在有角度的ui boostrap旋转木马上读取活动幻灯片

Javascript 在有角度的ui boostrap旋转木马上读取活动幻灯片,javascript,jquery,angularjs,twitter-bootstrap,Javascript,Jquery,Angularjs,Twitter Bootstrap,我正在使用我需要使用旋转木马作为图像选择器,但是我找不到绑定到所选$index的方法。有没有什么方法可以做到这一点,哪怕是一种简单的方法 我试着在标签上放置ng click=($index),但它在滑块控制下,因此在旋转木马滑动时不会触发 <carousel interval="carouselInterval" class="no-animate" > <slide ng-repeat="slide in token.images | eligibleWidth:2

我正在使用我需要使用旋转木马作为图像选择器,但是我找不到绑定到所选$index的方法。有没有什么方法可以做到这一点,哪怕是一种简单的方法

我试着在
标签上放置
ng click=($index)
,但它在滑块控制下,因此在旋转木马滑动时不会触发

<carousel interval="carouselInterval" class="no-animate" >
    <slide ng-repeat="slide in token.images | eligibleWidth:200"
           class="no-animate" ng-click="slideSelect($index)"> <!-- doesn't fire cuz under controls -->
        <img ng-src="{{slide.src}}" style="margin:auto;">

        <div class="carousel-caption">
            <h4>{{$index+1}} of {{(token.images | eligibleWidth:200).length}}</h4>

            <p >{{slide.caption}}</p>
        </div>
    </slide>
</carousel>

{{(token.images | eligibleWidth:200).length}的{{$index+1}}}
{{slide.caption}


以一种不太寻常的方式。使用onclick触发角度范围函数

<slide onclick="angular.element(this).scope().clickItem(this)" data-index="{{$index}}" >
   ...
<slide>
这是


希望这能起作用。

您能将演示代码发布到JSFIDLE吗?当然可以。谢谢-我的问题可能不太清楚,但当用户使用幻灯片控件时,我需要selectedIndex。请参阅我的标记中的注释“不触发,因为在控件下”。您的演示也有同样的问题:(查看bootstrap ui源代码..我认为这不是一个好的实践。但是在我检查之后。发现我可以使用幻灯片“活动”属性进行检查。因此我创建了一个手表函数来处理这个肮脏的工作..享受它:)晚上。太棒了!非常感谢。
$scope.clickItem = function(target){
    var ele = angular.element(target);
    var index = ele.attr('data-index');
};