私は問題here示す私のコードでPlunkerを作成している:あなたは、例えば上でクリックしたときにあなたが見ることができるようにAngularJS - チェックボックスの選択に/非表示のテーブルの列を表示する方法 - 生成された、ネストされたNG-繰り返しから
を'de'チェックボックスをオンにすると、テーブル見出しの表示/非表示を切り替えることができますが、ロケール(この場合は「de」)に対応するカラム見出しの下の値は<textarea>
ではありません。
チェックボックスの値locale.Selected
に応じて、<textarea>
をリンクする方法は考えられません。だから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>
hereのようなものをimplmentしようとすると - ユーザーは、チェックボックスをクリックすることができ、それが表示/非表示のテーブルの列を切り替えることができますせます。
ご注意:
vm.check = function(res) {
return vm.resourceGridResources.Locales.find(function(loc) {
return loc.Locale === res.LocaleId && loc.Selected;
});
};
:私は
ありません。しかしresource.Resourcesの$インデックスはview.resourceGridResources.Localesの$インデックスと並行してのだろうか? – Vivz