Created
May 26, 2014 18:18
-
-
Save lossendae/64b5ceb41b90382cb0be to your computer and use it in GitHub Desktop.
Angular filter in ng-repeat with sum on value length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- If I want to hide done todos --> | |
<ul class="whatever"> | |
<li data-ng-repeat="todo in todos | filter:{done: false}"> | |
... | |
</li> | |
</ul> | |
<!-- Show done todos --> | |
<div class="whatever" data-ng-show="(todos | filter:{done: true} ).length > 0"> | |
... | |
</div> | |
<!-- sums --> | |
<div class="whatever"> | |
<div>All: {{todos.length}}</div> | |
<div>Incomplete: {{(todos | filter:{done: false}).length}}</div> | |
<div>Done: {{(todos | filter:{done: true}).length}}</div> | |
</div> | |
There is more here : http://jsfiddle.net/mhevery/bpTXe/148/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment