Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature - Integrate with vs-repeat #134

Open
fourgates opened this issue Apr 4, 2018 · 2 comments
Open

New Feature - Integrate with vs-repeat #134

fourgates opened this issue Apr 4, 2018 · 2 comments

Comments

@fourgates
Copy link

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

@alejandroiglesias
Copy link

alejandroiglesias commented Nov 22, 2018

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

@fourgates
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants