{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/337","labels_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/337/comments","events_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/337/events","html_url":"https://github.com/angular-ui/ui-sortable/issues/337","id":57649284,"number":337,"title":"Having multiple ui-sortable elements within a controller, how to determine current model inside the stop handler ?","user":{"login":"rivaros","id":1242369,"avatar_url":"https://avatars.githubusercontent.com/u/1242369?v=3","gravatar_id":"","url":"https://api.github.com/users/rivaros","html_url":"https://github.com/rivaros","followers_url":"https://api.github.com/users/rivaros/followers","following_url":"https://api.github.com/users/rivaros/following{/other_user}","gists_url":"https://api.github.com/users/rivaros/gists{/gist_id}","starred_url":"https://api.github.com/users/rivaros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rivaros/subscriptions","organizations_url":"https://api.github.com/users/rivaros/orgs","repos_url":"https://api.github.com/users/rivaros/repos","events_url":"https://api.github.com/users/rivaros/events{/privacy}","received_events_url":"https://api.github.com/users/rivaros/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-ui/ui-sortable/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-02-13T20:23:06Z","updated_at":"2015-02-17T15:28:52Z","closed_at":"2015-02-13T20:41:07Z","body":"Imagine we have several ui-sortable elements on page, which use different models within same controller:\r\n```html\r\n<div ng-controller=\"MyCtrl\">\r\n<ul id=\"sortable1\" ui-sortable=\"sortableOptions\" ng-model=\"model1\">\r\n    <li ng-repeat=\"item in model1\">\r\n           {{ item.name }}\r\n    </li>\r\n</ul>\r\n<ul id=\"sortable2\" ui-sortable=\"sortableOptions\" ng-model=\"model2\">\r\n    <li ng-repeat=\"item in model2\">\r\n           {{ item.name }}\r\n    </li>\r\n</ul>\r\n</div>\r\n```\r\n\r\nWhat is the correct way to access the current model inside the stop event-handler\r\n```javascript\r\napp.controller('MyCtrl', ['$scope', function($scope) {\r\n    $scope.sortableOptions = {\r\n        axis: 'y',\r\n        stop: function(e, ui) {\r\n            //This gives us the current item scope, yes\r\n            //But how do we know that we are now moving items in model1 and not in model2, for example?\r\n            ui.item.scope();\r\n           \r\n        }\r\n    };\r\n}]);\r\n```\r\n\r\nThis might be some core Angular question, but I got stuck on it, and would appreciate your help."},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/comments/74685668","html_url":"https://github.com/angular-ui/ui-sortable/issues/337#issuecomment-74685668","issue_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/337","id":74685668,"user":{"login":"rivaros","id":1242369,"avatar_url":"https://avatars.githubusercontent.com/u/1242369?v=3","gravatar_id":"","url":"https://api.github.com/users/rivaros","html_url":"https://github.com/rivaros","followers_url":"https://api.github.com/users/rivaros/followers","following_url":"https://api.github.com/users/rivaros/following{/other_user}","gists_url":"https://api.github.com/users/rivaros/gists{/gist_id}","starred_url":"https://api.github.com/users/rivaros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rivaros/subscriptions","organizations_url":"https://api.github.com/users/rivaros/orgs","repos_url":"https://api.github.com/users/rivaros/repos","events_url":"https://api.github.com/users/rivaros/events{/privacy}","received_events_url":"https://api.github.com/users/rivaros/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T15:28:52Z","updated_at":"2015-02-17T15:28:52Z","body":"YYES, that was it. Thanks again."}}