Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 5b525e8

Browse files
committed
docs(README): add note about applying filters
1 parent 829ee3f commit 5b525e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ Apply the directive to your form elements:
4646
* `ui-sortable` element should only contain one `ng-repeat` and not any other elements (above or below).
4747
Otherwise the index matching of the generated DOM elements and the `ng-model`'s items will break.
4848
**In other words: The items of `ng-model` must match the indexes of the generated DOM elements.**
49+
* [`Filters`](https://docs.angularjs.org/guide/filter) that manipulate the model (like [filter](https://docs.angularjs.org/api/ng/filter/filter), [orderBy](https://docs.angularjs.org/api/ng/filter/orderBy), [limitTo](https://docs.angularjs.org/api/ng/filter/limitTo),...) should be applied in the `controller` instead of the `ng-repeat` (refer to [the provided exaples](#examples)).
50+
This is the prefered way since it:
51+
- is performance wise better
52+
- reduces the chance of code duplication
53+
- [is suggested by the angularJS team](https://www.youtube.com/watch?feature=player_detailpage&v=ZhfUv0spHCY#t=3048)
54+
- it does not break the matching of the generated DOM elements and the `ng-model`'s items
4955
* `ui-sortable` lists containing many 'types' of items can be implemented by using dynamic template loading [with ng-include](http://stackoverflow.com/questions/14607879/angularjs-load-dynamic-template-html-within-directive/14621927#14621927) or a [loader directive](https://github.com/thgreasi/tg-dynamic-directive), to determine how each model item should be rendered. Also take a look at the [Tree with dynamic template](http://codepen.io/thgreasi/pen/uyHFC) example.
5056

5157
### Options

0 commit comments

Comments
 (0)