Angularjs:如何在跳过给定的$index值的同时使用ng repeat,仍然达到并限制到-3个结果?
我的搜索引擎最多必须显示3张照片,加上数据源照片列表中包含的一张主照片 我有这个代码片段,第一个表列选择了合适的photo diag.photoId-1,而第三个表列则从数据源中拍摄了前三张照片。 除了dig.photoId-1是我跳过的前三张照片中的一张外,一切都很顺利,但后来我错过了一张 有什么简单的方法可以通过创建特定数据源或更改数据源来处理此问题Angularjs:如何在跳过给定的$index值的同时使用ng repeat,仍然达到并限制到-3个结果?,angularjs,ng-repeat,Angularjs,Ng Repeat,我的搜索引擎最多必须显示3张照片,加上数据源照片列表中包含的一张主照片 我有这个代码片段,第一个表列选择了合适的photo diag.photoId-1,而第三个表列则从数据源中拍摄了前三张照片。 除了dig.photoId-1是我跳过的前三张照片中的一张外,一切都很顺利,但后来我错过了一张 有什么简单的方法可以通过创建特定数据源或更改数据源来处理此问题 <tr ng-repeat="diag in accidentSearchResults">
<tr ng-repeat="diag in accidentSearchResults">
<td class="key textOutline"
style="background-image:url(rsc/accident/thumb/{{accidents[diag.accidentId].id}}/{{accidents[diag.accidentId].photos[diag.photoId-1].file}}.thumb.jpg)">
<div class="cut-arrow-right"></div>
<p>{{accidents[diag.accidentId].displayName}}</p>
</td>
<td>
<div class="notScrollable">
<div
class="disk"
ng-repeat="p in accidents[diag.accidentId].photos | limitTo: 3"
ng-if="$index != diag.photoId-1"
ng-click="openAccidentPage(diag.accidentId)"
style="background-image:url(rsc/accident/thumb/{{accidents[diag.accidentId].id}}/{{p.file}}.thumb.jpg)"></div>
</div>
</td>
</tr>
对不起,忘了它吧,我的灯泡刚刚亮了……limito:diag.photoId-1你也可以为此编写一个过滤器。