Angular Selection Model (GitHub: jtrussell / angular-selection-model, License: MIT) by Justin Russell is an AngularJS directive for managing selections of items in lists and tables. It's indifferent to how data is presented, and only tracks what items are selected.
This example allows a text input to filter a list of items, and also allow the user to select items from the list:
<input type="text" ng-model="fancyfilter" /> <table> <thead> <tr> <th></th> <th>#</th> <th>Label</th> <th>Value</th> </tr> </thead> <tr ng-repeat="item in fancy.bag | filter:fancyfilter" selection-model selection-model-type="checkbox" selection-model-mode="multiple-additive" selection-model-selected-class="foobar"> <td><input type="checkbox"></td> <td>1</td> <td></td> <td></td> </tr> </table>
The directive does a lot of things behind the scenes to make this work naturally. An internal read-only list is used to represent selected items, and there's a provider for setting things like the selected attribute and class name assigned to selected items at a global level. Checkboxes are automatically managed, including support for multiple selection.
Justin has included tests, documentation, and examples.
The reason I wanted to write about it was he decided to license it as "Abandoned", so rather than letting it languish I thought I'd share it in case someone finds it useful.
Here's how Adrian described the project: