我在我的html頁面中使用mdVirtualRepeat
指令時遇到問題。問題是我需要在同一個標籤中包含一個html。這是我應該需要做的:
<table>
<thead>
<tr>
<th ng-repeat="header in headers">
{{header.title}}
</th>
</tr>
</thead>
<tbody md-virtual-repeat-container
id="vertical-container"
md-auto-shrink = "true"
md-virtual-repeat="item in items.list"
data-ng-include="./details.html'">
</tbody>
</table>
和details.html
頁面包含我的表中的列2 TR。喜歡的東西:
<tr>
<td>
{{item..}}
</td>
<td>
{{item..}}
</td>
</tr>
<tr>
<td colspan="2">
{{item..}}
</td>
</tr>
真正的問題是,item
需要在所有detail.html頁面中使用它。所以我不能在第一個<tr>
標籤中循環,因爲在第二個我不能再使用它了。但這樣我就不能使用該指令,因爲我得到這個錯誤:Error: [$compile:multidir] Multiple directives [mdVirtualRepeat, ngInclude] asking for transclusion
有沒有辦法解決這個問題?
編輯: 或者有可能是這樣的嗎?
<tr md-virtual-repeat="item in items.list">
<td>
{{item..}}
</td>
<td>
{{item..}}
</td>
</tr>
<tr>
<td colspan="2">
{{item..}} (use item also here out of ng-repeat?)
</td>
</tr>
你想'details.html'你'損益後出現',還是之前,或者以某種方式混合在一起? – Rhumborl
我需要的是循環所有details.html md虛擬重複,因爲我張貼。但那樣我就有了錯誤。 –
也許你應該創建一個簡單的指令,'details.html'就是它的模板 – yarons