javascript - 使用 ng-repeat 在 bootstrap corousel 中显示 9 个项目
问题描述
总共 20 张图片,我必须在每个滑块中显示 9 个项目,所以总共 3 个滑块。
我尝试了以下链接
<div class='greybg' ng-repeat="comment in location.comments">
<div class="row">
<div id="myCarousel{{location.comments[0]._id}}" class="carousel slide" data-ride="carousel">
<div class="carousel-inner multiple_pictures" >
<div class="item" ng-class="{active:!$index}">
<div class="row" >
<div class="col-sm-4" ng-repeat="images in comment.images.slice(0,9)">
<img ng-src={{images.path}} alt="First slide"> <div class="gplabel">{{$index+1}}</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4" ng-repeat="images in comment.images.slice(9,18)">
<img ng-src={{images.path}} alt="First slide"> <div class="gplabel">{{$index+1+9}}</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4" ng-repeat="images in comment.images.slice(18,27)">
<img ng-src={{images.path}} alt="First slide"> <div class="gplabel">{{$index+1+18}}</div>
</div>
</div>
</div>
<a ng-if="comment.images.length>1" class="left carousel-control" href="#myCarousel{{location.comments[0]._id}}" role="button"
data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a ng-if="comment.images.length>1" class="right carousel-control" href="#myCarousel{{location.comments[0]._id}}" role="button"
data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div></div></div>
但是图像计数将是动态的,所以如果我有 50 张图像意味着我必须写 6 次。我如何根据图像计数动态执行此操作。
解决方案
推荐阅读
- tree - 线性时间的 MST,边权重 {1 到 100}
- selenium - 从 Windows 计划任务以 SYSTEM 用户身份执行 Selenium 失败的原因
- r - 使用简单的 for 循环将状态名称与相应的状态编号匹配
- javascript - 使用“createElement”创建按钮时执行按钮的 onclick 属性
- openmdao - 衍生品警告没有意义
- mysql - 使用空间数据查询慢,如何加快
- java - 需要链接 private_key.pem 和 chain.crt
- winapi - 调用 GetDIBits() 成功,但程序终止
- ios - 将视频从 JSON 解析为 Swift (SwiftUI)
- junit - JUnit4 - 参数化测试扩展了参数化基类 - 需要它们的笛卡尔积