在Angular.js中,点击前一行显示下一行(隐藏的)

Showing the next row(Which is hidden) on click of the previous row in Angular.js

本文关键字:一行 显示 隐藏 Angular js      更新时间:2023-09-26

我们有一个html数据表,其中有交替行。一行状态为SHOW,另一行状态为DONE。例如,

<table ng-repeat="item in dataSet| ng-hide="item.Status == 'DONE')"><tr><td ng-click ="showDoneRow();">{{item.PrimaryKey}}</td><td>{{item.Status}}</td></tr></table>

现在单击具有Status SHOW的行的PrimaryKey,我们需要显示具有Status DONE的下一行。请记住,状态为DONE的行已经被隐藏了。

请问有谁能给我一个解决这个问题的办法吗

首先是,你在错误的地方重复,你在重复一个表,你应该重复一行。然后写入ng-hide separate from ng-repeat

<table ng-repeat="| )">
  <tr ng-repeat="item in dataSet" ng-init="item.display = item.Status !== 'DONE'" ng-show="item.display">
    <td ng-click="dataSet[$index+1].display=true">{{item.PrimaryKey}}</td>
    <td>{{item.Status}}</td>
  </tr>
</table>

并检查ng-click,设置ng-show。使用ng-init,我创建了一个新的属性显示,它决定是否显示/隐藏项目。然后点击下一个项目索引并将其显示属性设置为true