Without the extra junk
Yeah, there are a bunch of grid and table directives out there
already. The selectionModel
directive is unique in that it
is indifferent to how your data is presented and only concerns itself
with tracking which items are (and are not) selected.
Want to use a fancy table? Sure. Prefer to work with lists? That
works. Just a bunch of div
s? That's cool too!
selectionModel
is just a companion for
ngRepeat
if you can use ngRepeat
to present
your data, you can use selectionModel
to manage your
selection.
How about some demos?
Getting up and running is a snap. Include the
selectionModel
script on your page and add
it as a depedency to your angular app.
The selectionModel
directive works with
ngRepeat
, it keys in on a boolean attribute on your
collection items (configurable) and assigns a css class to selected items
in the view (also configurable). Here's a basic example:
Someone so fancy would choose the {{fancy.selectedItems[0].label | lowercase}}.
That's literally zero lines of code to manage the selection. No click handlers. No view helpers.
Is super easy! You can have the same collection power multiple grids or views and never worry about syncing selections.
Two {{fancy.selectedItems[0].label}}s?!?! That's too many!
There are tons of ways to configure the selectionModel
directive. You can:
ngRepeat
partners in crime - filters,
paging, ... already built into Angular.The selectionModel
directive is built to manage your
selections and get out of the way. Use your own list and table styles
and don't jump through hurdles to skin complex widgets.
Here's a more involved example.
# | Label | Value | |
---|---|---|---|
{{$index + 1}} | {{item.label}} | {{item.value}} |
Still want more? Check out the GitHub repo.