angular-sortable-view
angular-sortable-view copied to clipboard
New Feature - Integrate with vs-repeat
would it be possible at all to have some integration with the vs-repeat directive?
@fourgates it would be great if this was made easy. In any case, I managed to do it the following way (excuse me for sharing Pug code instead of HTML):
.container
.list-group(
sv-on-sort="$ctrl_.itemMoved($indexFrom, $indexTo)"
sv-part="$vs_collection"
sv-root
vs-repeat="{scrollParent: '.container'}"
)
.list-group-item(
ng-repeat="item in $ctrl_.items track by item.id"
sv-element="{containment: '.list-group'}"
)
Notice that A) I've used $ctrl_ as the controller name (controllerAs component param) since $ctrl is overriden by angular-sortable-view, and B) sv-part="$vs_collection" instead of $ctrl_.items. $vs_collection is put into scope by angular-vs-repeat and contains the reduced subset of items that are actually displayed.
I hope it helps, it worked for me.
very interesting... I am making to some update to the app that uses this in the next couple weeks and I look forward to testing this out. Thanks @alejandroiglesias