我在这个项目中使用typescript和angular。 我有一个隐藏的列,'th'和'td都隐藏着。如果用户想要删除一行,我想显示该特定行的隐藏列。它是'ng-hide ='$ ctrl.isInvisible''的行,它应该在表头中显示,并且在成员列出的行中具体的'td',并且它具有相同的'ng-hide'在一个表格行中显示隐藏列
我现在代码:
HTML
<table>
<thead>
<tr
<th>Name</th>
<th>Class</th>
<th>Amount</th>
<th>Delete</th>
<th ng-hide="$ctrl.isInvisible">Restore</th> <!--this is the hidden th-->
</tr>
</thead>
<tbody>
<tr ng-repeat="member in $ctrl.members| orderBy: '-id'">
<td>{{member.name}}</td>
<td>{{member.class}}</td>
<td>{{member.amount}}</td>
<td>
<a href="#" ng-click="$ctrl.removeMember(member)">
<i class="material-icons listicon">delete</i>
</a>
</td>
<td ng-hide="$ctrl.isInvisible">
<a href="#" ng-click="$ctrl.restoreMember(member)">
<i class="material-icons listicon">restore</i>
</a>
</td> <!--This is the hidden td -->
</tr>
</tbody>
</table>
构造函数设置 'isInvisible =真正的',这样的作品。但是我的代码,使每一个“TD”显示恢复图标,当一个表项设置为被删除:
打字稿:
removeMember() {
this.isInvisible = false;
}
有谁知道如何显示隐藏的“日”和具体“ td'但仍然保留'td的其余部分隐藏?
你可以添加一个工作小提琴 –