angular-sortable-view icon indicating copy to clipboard operation
angular-sortable-view copied to clipboard

New Feature - Integrate with vs-repeat

Open fourgates opened this issue 7 years ago • 2 comments

would it be possible at all to have some integration with the vs-repeat directive?

fourgates avatar Apr 04 '18 16:04 fourgates

@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.

alejandroiglesias avatar Nov 22 '18 15:11 alejandroiglesias

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

fourgates avatar Jan 10 '19 17:01 fourgates