我有一個保存在var images
中的圖像列表,以及保存在var searchName
中的名字列表,現在我需要顯示圖像和名字,但是我可以在所有圖像。在同一張表中處理兩個ng-repeat
HTML:
<div class="row col-sm-12" >
<table class="displayImg col-sm-3">
<tr ng-repeat = "image in images">
<td><img ng-src="{{image}}" class="imageShow"/> </td>
</tr>
<tr ng-repeat = "item in searchName">
<td>{{item[0].profileInfo.firstname}} </td>
</tr>
</table>
</div>
如果圖像和名稱,然後之間的關係,根據您的要求合併兩個數組或試試這個: http://stackoverflow.com/questions/30846032/looping-multiple-arrays-simultaneously-with-ng-repeat –
@Nicoleta - 你可以先準備好合併你的控制器上的數據如果圖像和項目之間有關係,你也可以嘗試使用ng-repeat-start,ng-repeat-end。 https://docs.angularjs.org/api/ng/directive/ng重複 – Bhuneshwer
是的,我有圖像和數據之間的關係,我會看這個文件。 –