AngularJS toggle ng-repeat visibility with checkbox

Question!

So I have a list of notices in AngularJS which I create with ng-repeat. The notices have a visibility status which determines whether the notice is shown in the list. Every notice has controls which allow that notice to be hidden (simple button that changes the notice.status.visibility to false).

I also have a checkbox input that is supposed to show hidden notices. I am however unsure on how to implement this and how would it work.

HTML:

<ul>
    <input type="checkbox" value="Show Hidden" />

    <li ng-repeat="notice on notices | filter: filter.search">
        <div ng-show="notice.status.visibility">
            <!-- notice details -->
        </div>

    </li> 
</ul>
By : Tomkarho


Answers

maybe with something like that ?

<ul>
    <input type="checkbox" value="Show Hidden" ng-model="showHiden" />

    <li ng-repeat="notice on notices | filter: filter.search">
        <div ng-show="showHidden || notice.status.visibility">
            <!-- notice details -->
        </div>

    </li> 
</ul>


This video can help you solving your question :)
By: admin