我創建了一個Plunker我的代碼顯示問題here生成:AngularJS - - 如何在複選框選擇顯示/隱藏表列從嵌套NG重複
正如你可以看到當你點擊例如'de'複選框會切換顯示/隱藏表格標題 - 但不是列標題下的<textarea>
值,對應於區域設置(在本例中爲'de'),這正是我目前試圖使用的。
我不能想到一種方法來鏈接<textarea>
取決於locale.Selected
複選框的值。所以當locale.Locale == res.LocaleID
我想顯示/隱藏取決於locale.Selected
值。
<table class="table">
<tr>
<th>Resource Id</th>
<th ng-repeat="locale in view.resourceGridResources.Locales" ng-show="locale.Selected">
{{locale.Locale ? locale.Locale : "invariant" }}
</th>
</tr>
<tr ng-repeat="resource in view.resourceGridResources.Resources">
<td>{{resource.ResourceId}}</td>
<td ng-repeat="res in resource.Resources">
<textarea ng-model="res.Value"
ng-blur="view.saveGridResource(res)"
style="min-width: 300px"
//trying to get to locale.Selected here - how get index 'x'?
ng-show="view.resourceGridResources.Locales[x].Selected">
</textarea>
</td>
</tr>
</table>
試圖implment像here - 由此用戶可以在複選框,單擊它會觸發隱藏/顯示錶列。
請注意:我的演示plunker是我更大的項目問題,只是例子,所以我必須對不斷變化的JSON格式等沒有控制
不,但是resource.Resources的$指數將與view.resourceGridResources.Locales的$指數並行? – Vivz