“Angular-ui bootstrap”を使用して、Bootstrap3のJavaScript部分をAngularJSに置き換えることができます。今回はcarouselのサンプルを作成しました。
※オンラインマニュアル
Angular directives for Bootstrap
Angular-ui bootstrap : 2.5.0
AngularJS : 1.6.5
Bootstrap : 3.3.7
<!DOCTYPE html> <html ng-app="demoApp"> <head> ...... <script src="../js/angular-1.6.5.min.js"></script> <script src="../js/ui-bootstrap-tpls-2.5.0.min.js"></script> <link href="../js/app.js"> <link href="../css/bootstrap-3.3.7.min.css" rel="stylesheet"> </head> ..... <div ng-controller="CarouselDemoCtrl"> <div style="height: 305px"> <div uib-carousel active="active" interval="myInterval" no-wrap="noWrapSlides"> <div uib-slide ng-repeat="slide in slides track by slide.id" index="slide.id"> <img ng-src="{{slide.image}}" style="margin:auto;"> <div class="carousel-caption"> <h4>Slide {{slide.id + 1}}</h4> <p>{{slide.text}}</p> </div> </div> </div> </div> </div>
var demoApp = angular.module('demoApp', ['ui.bootstrap']); demoApp.controller("CarouselDemoCtrl", function($scope) { $scope.myInterval = 5000; $scope.noWrapSlides = false; $scope.active = 0; $scope.slides = [ { image: 'http://placekitten.com/g/600/300', text: 'one', id: 0 }, { image: 'http://placekitten.com/g/601/300', text: 'two', id: 1 }, { image: 'http://placekitten.com/g/602/300', text: 'three', id: 2 }, ]; });