【问题标题】:Angular Carousal not working with ng-repeatAngular Carousel 不适用于 ng-repeat
【发布时间】:2018-07-29 15:50:42
【问题描述】:

我正在研究 angular carousal 以制作以数组形式出现的图像幻灯片。 但不幸的是,它不能用作滑块。

如何解决这个问题?有什么解决办法吗?

//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

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

【问题讨论】:

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


    【解决方案1】:

    不管怎样,我用它修复了它,

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

    【讨论】:

      猜你喜欢
      • 2014-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多