0

在 AngularJS 中,我该如何做以下代码试图实现的目标,即如果 task.status 设置为特定值,则隐藏跨度?

<li ng-repeat="task in tasks">

    Move to:
    <span ng-hide="task.status=todo">Todo</span>
    <span ng-hide="task.status=doing">Doing</span>
    <span ng-hide="task.status=done">Done</span>

</li>
4

1 回答 1

4
<li ng-repeat="task in tasks">
    Move to:
    <span ng-hide="task.status == todo">Todo</span>
    <span ng-hide="task.status == doing">Doing</span>
    <span ng-hide="task.status == done">Done</span>
</li>

或者

<li ng-repeat="task in tasks">
  <div ng-switch on="task.status" >
    <span ng-switch-when="todo">Todo</div>
    <span ng-switch-when="doing">Doing</div>
    <span ng-switch-when="done">Done</div>
  </div>
</li>
于 2013-05-29T12:43:45.787 回答