引导转盘不angularjs工作 [英] Bootstrap carousel not working with angularjs

查看:387
本文介绍了引导转盘不angularjs工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要沿着使用引导转盘具有角JS以显示旋转木马的图片。
但是,当导航链接点击后,会显示空白页。

我的code示例如下。 (注意:这code只能用行之有效的引导3.1.0 而不是沿 AngularJS 1.2.13

 < D​​IV ID =旋转木马类=旋转木马幻灯片>
    < OL类=旋转木马的指标>
        <李的数据目标=旋转木马数据滑动至=0级=主动>< /李>
        <李的数据目标=旋转木马数据滑动至=1>< /李>
        <李的数据目标=旋转木马数据滑动至=2>< /李>
    < / OL>
    < D​​IV CLASS =旋转木马-内>
        < D​​IV CLASS =项目活动>
            < IMG SRC =图像/ c.png级=IMG响应>
        < / DIV>
        < D​​IV CLASS =项>
            < IMG SRC =图像/ b.png级=IMG响应>
        < / DIV>
        < D​​IV CLASS =项>
            < IMG SRC =图像/ a.png级=IMG响应>
        < / DIV>
    < / DIV>
    <一类=左旋转木马控制的href =#旋转木马数据滑=preV>
        <跨度类=glyphicon glyphicon雪佛龙左>< / SPAN>
    &所述; / A>
    <一类=右旋转木马控制的href =#旋转木马数据滑=下一步>
       <跨度类=glyphicon glyphicon - 雪佛龙权>< / SPAN>
    &所述; / A>
< / DIV>


解决方案

这是什么rbanning楼说的,而不是添加事件处理程序,你可以,用span标签更换锚标记后,用数据替换href属性-target属性和引导取剩下的事情。

像这样:

 < D​​IV ID =旋转木马类=旋转木马幻灯片>
< OL类=旋转木马的指标>
    <李的数据目标=旋转木马数据滑动至=0级=主动>< /李>
    <李的数据目标=旋转木马数据滑动至=1>< /李>
    <李的数据目标=旋转木马数据滑动至=2>< /李>
< / OL>
< D​​IV CLASS =旋转木马-内>
    < D​​IV CLASS =项目活动>
        < IMG SRC =图像/ c.png级=IMG响应>
    < / DIV>
    < D​​IV CLASS =项>
        < IMG SRC =图像/ b.png级=IMG响应>
    < / DIV>
    < D​​IV CLASS =项>
        < IMG SRC =图像/ a.png级=IMG响应>
    < / DIV>
< / DIV>
<跨度类=左旋转木马控制数据目标=#旋转木马数据滑=preV>
    <跨度类=glyphicon glyphicon雪佛龙左>< / SPAN>
< / SPAN>
<跨度类=右旋转木马控制数据目标=#旋转木马数据滑=下一步>
   <跨度类=glyphicon glyphicon - 雪佛龙权>< / SPAN>
< / SPAN>
< / DIV>

I want to use bootstrap carousel along with angular js to display images in carousel content. But, when the navigation links clicked, it displays blank page.

My code sample is as follows. (Note : This code works well only with Bootstrap 3.1.0 but not along with AngularJS 1.2.13)

<div id="Carousel" class="carousel slide">
    <ol class="carousel-indicators">
        <li data-target="Carousel" data-slide-to="0" class="active"></li>
        <li data-target="Carousel" data-slide-to="1"></li>
        <li data-target="Carousel" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner">
        <div class="item active">
            <img src="images/c.png" class="img-responsive">
        </div>
        <div class="item">
            <img src="images/b.png" class="img-responsive">
        </div>
        <div class="item">
            <img src="images/a.png" class="img-responsive">
        </div>
    </div>
    <a class="left carousel-control" href="#Carousel" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="right carousel-control" href="#Carousel" data-slide="next">
       <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
</div>

解决方案

Building on what rbanning said, instead of adding the event handler you can just, after replacing the anchor tags with span tags, replace the href attribute with a "data-target" attribute and bootstrap takes care of the rest.

Like so:

<div id="Carousel" class="carousel slide">
<ol class="carousel-indicators">
    <li data-target="Carousel" data-slide-to="0" class="active"></li>
    <li data-target="Carousel" data-slide-to="1"></li>
    <li data-target="Carousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
    <div class="item active">
        <img src="images/c.png" class="img-responsive">
    </div>
    <div class="item">
        <img src="images/b.png" class="img-responsive">
    </div>
    <div class="item">
        <img src="images/a.png" class="img-responsive">
    </div>
</div>
<span class="left carousel-control" data-target="#Carousel" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
</span>
<span class="right carousel-control" data-target="#Carousel" data-slide="next">
   <span class="glyphicon glyphicon-chevron-right"></span>
</span>
</div>

这篇关于引导转盘不angularjs工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆