{"action":"closed","issue":{"url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/370","labels_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/370/comments","events_url":"https://api.github.com/repos/angular-ui/ui-sortable/issues/370/events","html_url":"https://github.com/angular-ui/ui-sortable/issues/370","id":90126820,"number":370,"title":"How do I update an attribute in a model in a ui-sortable list?","user":{"login":"chrismanderson","id":418258,"avatar_url":"https://avatars.githubusercontent.com/u/418258?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismanderson","html_url":"https://github.com/chrismanderson","followers_url":"https://api.github.com/users/chrismanderson/followers","following_url":"https://api.github.com/users/chrismanderson/following{/other_user}","gists_url":"https://api.github.com/users/chrismanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismanderson/subscriptions","organizations_url":"https://api.github.com/users/chrismanderson/orgs","repos_url":"https://api.github.com/users/chrismanderson/repos","events_url":"https://api.github.com/users/chrismanderson/events{/privacy}","received_events_url":"https://api.github.com/users/chrismanderson/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":1,"created_at":"2015-06-22T15:08:17Z","updated_at":"2015-06-22T15:38:15Z","closed_at":"2015-06-22T15:38:15Z","body":"New to ui-sortable and angular, so apologies if this is a dumb question.\r\n\r\nSay I have an array of models with a `id`, `name`, `route-order` attribute. I want the `route-order` field to reflect the current order of the index in my ui sortable list. So, if I move something to index 3, all of the route-order fields of all of the items in the array should update to their corresponding index. That way, when I post the changes to my API, everything is updated properly.\r\n\r\nIs the way I should accomplish this by looping through the items in `ui.item.sortable.sourceModel` and updating the attribute in there? That seems wrong to me, so wondering if there is a better solution.\r\n\r\nThanks!"}}