我有ul
ng-repeat
,我试图在未选中复选框时隐藏某些值。基本上,我在JSON文件中有两种不同的状态:new
和completed
。
我希望在勾选复选框时显示已完成的复选框,并在未选中复选框时隐藏它们。
我的代码如下:
<div>
<input ng-model="$ctrl.query" placeholder="Search">
<input type="checkbox" ng-model="self.information">
<span> Show Completed </span>
</div>
<div class="container:fluid" id="list">
<ul>
<li ng-repeat="info in self.information |
filter: {'status': 'complete'}" ng-show="self.information">
<div class="row">
<!-- LI CONTENTS -->
</li>
</ul>
</div>
答案 0 :(得分:1)
<div>
<input ng-model="$ctrl.query" placeholder="Search">
<input type="checkbox" ng-model="self.information" ng-true-value="completed" ng-false-value="new">
<span> Show Completed </span>
</div>
<div class="container:fluid" id="list">
<ul>
<li ng-repeat="info in self.information |
filter: {'status': self.information}">
<div class="row">
<!-- LI CONTENTS -->
</li>
</ul>
</div>
我希望它有所帮助:)