2016-11-04 93 views
0

我有一個ulng-repeat,我試圖使一些值隱藏,當一個複選框未打鉤。基本上,我有一個JSON文件中的2個不同的狀態:newcompletedAngularJS,在複選框上的過濾器

我想要完成的時候顯示一個複選框被選中,並且當一個複選框未被選中時,它們將被隱藏。

我的代碼如下:

<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

製作的jsfiddle總是讓別人更容易做出貢獻。 – Mahbub

回答

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> 

我希望它能幫助:)

+0

Tahnks很多,但對不起,它沒有工作,我現在要添加小提琴來幫助! –