Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a twitter bootstrap carousel in an angular app. If I use the data-slide attribute thus:

<a data-slide="prev" href="#myCarousel" class="left carousel-control">&lsaquo;</a>

then the href=#myCarousel in interpreted as a route and the current page is reloaded. (I am using HTML5 mode)

I can get carousel working by replacing with this:

<a href="#" class="left carousel-control" ng-click="carouselPrev()">&lsaquo;</a>

and in the controller:

$scope.carouselPrev = function(){
    $('#myCarousel').carousel('prev');
};

but what is the right way to do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.8k views
Welcome To Ask or Share your Answers For Others

1 Answer

Or...use this: Angular-UI - Bootstrap (includes a carousel directive.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...