0

I have a ul with ng-repeat, and I am trying to make some values hide when a checkbox is unticked. Essentially I have 2 different statuses in a JSON file: new and completed.

I want completed ones to show when a checkbox is ticked and for them to hide when a checkbox is unticked.

My code is below:

<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>
1
  • Making a jsfiddle always makes it easier for others to contribute. Commented Nov 4, 2016 at 12:25

1 Answer 1

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>

I hope it helps :)

Sign up to request clarification or add additional context in comments.

1 Comment

Tahnks a lot, but sorry it didn't work, I'm going to add a fiddle now to help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.