使用ng-view文件angular js,bootstrap carousel无法正常工作

时间:2016-06-09 16:10:14

标签: angularjs twitter-bootstrap carousel

我是bootstrap和AngularJs的新手。我正在为我当前的应用程序使用bootstrap和Angular Js。当我直接在索引页面内使用bootstrap轮播时,轮播的滑动链接工作绝对完美。但是当我使用ng-view通过第二个文件加载轮播标记时,幻灯片链接无法正常工作。它只能工作一次,然后下次不能工作。哪里出错了我粘贴下面的代码:

<div id="myCarousel" class="carousel slide myslider" data-ride="carousel" data-interval="2000">

    <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
        <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <div class="carousel-inner" role="listbox">
        <div class="item active">
            <img src="img/d.jpg" alt="d1" class="center-block">
        </div>

        <div class="item">
            <img src="img/c2.jpg" alt="c2" class="center-block">
        </div>

        <div class="item">
            <img src="img/b.jpg" alt="b3" class="center-block">
        </div>
        <div class="item">
            <img src="img/a.jpg" alt="a4" class="center-block">
        </div>

    </div>

    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
    </a>

    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
    </a>
</div>

0 个答案:

没有答案