angular-ui / ui-sortable

jQuery UI Sortable for AngularJS
http://angular-ui.github.io/ui-sortable/
MIT License
1.26k stars 443 forks source link

Access to parent repeater item in update event #487

Closed P4trik closed 8 years ago

P4trik commented 8 years ago

Hey,

I got the follow scenario: `

  • {{product.name}}
            </div>`

Is it somehow possible to access the shelf property of my outer repeater, inside the update event of the sortableOptionsList[0] setting? Update event supplies me the list of UL-Elements but I have to access the element above.

Hope it's understandable :-/

Thanks for great support!

thgreasi commented 8 years ago

Unfortunately, this has to be done in the controller, by having it assigned to a local var. In case you have multiple lists, you should probably also check which one contains the moved item.

A hacky way that will not work on DisabledDebugInfo invironment would look like this:

ui.item.source.scope().shelf

PS : Didn't actually tested the above code, but it demonstrates the concept of this hacky approach.