Angular Carousal不使用ng-repeat

时间:2018-02-19 11:56:40

标签: javascript css angularjs angularjs-ng-repeat carousel

我正在制作角形转盘以制作以阵列形式出现的图像幻灯片。 但不幸的是它不能作为滑块。

如何解决这个问题?任何解决方案?

// HTML

<div id="myCarousel" class="carousel slide" data-ride="carousel"> 
    <div class="carousel-inner">
        <div class="item {{::($index === 0 ? 'active' : '')}}"  ng-repeat="img in vehicleImgArr"> <img src="{{img}}">
          <div class="container">
            <div class="carousel-caption"> </div>
          </div>
        </div>
    </div>
</div>
<ol class="carousel-indicators">
<li data-target="#myCarousel" ng-repeat="img in vehicleImgArr"  data-slide-to="{{img}}"></li>
</ol>

// JS

var app = angular.module('VehicleDetails', ['angularUtils.directives.dirPagination']);
  app.controller('vehiclefulldetails',['$scope', '$http', function($scope, $http){

    if($scope.vehicletrxdetails[0].document_name != null){
        $scope.vehicleImg = $scope.vehicletrxdetails[0].document_name;
        $scope.vehicleImgArr = $scope.vehicleImg.split(',');
    }


}]);

Example: vehicletrxdetails[0].document_name = https://files.allaboutbirds.net/wp-content/uploads/2015/06/prow-featured.jpg, https://www.scientificamerican.com/sciam/cache/file/268F292B-5DDD-4DB1-B5ABC6541A70ECDF_source.jpg

任何帮助都会很棒。 提前致谢

1 个答案:

答案 0 :(得分:0)

无论如何我用它来修复它,

$("ol.carousel-indicators").click(function(e){
    e.preventDefault();
    $(this).parent().carousel($(this).data("slide"));
});