{"action":"created","issue":{"url":"https://api.github.com/repos/luckylooke/dragular/issues/8","labels_url":"https://api.github.com/repos/luckylooke/dragular/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/luckylooke/dragular/issues/8/comments","events_url":"https://api.github.com/repos/luckylooke/dragular/issues/8/events","html_url":"https://github.com/luckylooke/dragular/issues/8","id":94846527,"number":8,"title":"ngRepeat - Keep array in sync","user":{"login":"jameswyse","id":1144357,"avatar_url":"https://avatars.githubusercontent.com/u/1144357?v=3","gravatar_id":"","url":"https://api.github.com/users/jameswyse","html_url":"https://github.com/jameswyse","followers_url":"https://api.github.com/users/jameswyse/followers","following_url":"https://api.github.com/users/jameswyse/following{/other_user}","gists_url":"https://api.github.com/users/jameswyse/gists{/gist_id}","starred_url":"https://api.github.com/users/jameswyse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameswyse/subscriptions","organizations_url":"https://api.github.com/users/jameswyse/orgs","repos_url":"https://api.github.com/users/jameswyse/repos","events_url":"https://api.github.com/users/jameswyse/events{/privacy}","received_events_url":"https://api.github.com/users/jameswyse/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/luckylooke/dragular/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"jameswyse","id":1144357,"avatar_url":"https://avatars.githubusercontent.com/u/1144357?v=3","gravatar_id":"","url":"https://api.github.com/users/jameswyse","html_url":"https://github.com/jameswyse","followers_url":"https://api.github.com/users/jameswyse/followers","following_url":"https://api.github.com/users/jameswyse/following{/other_user}","gists_url":"https://api.github.com/users/jameswyse/gists{/gist_id}","starred_url":"https://api.github.com/users/jameswyse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameswyse/subscriptions","organizations_url":"https://api.github.com/users/jameswyse/orgs","repos_url":"https://api.github.com/users/jameswyse/repos","events_url":"https://api.github.com/users/jameswyse/events{/privacy}","received_events_url":"https://api.github.com/users/jameswyse/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/luckylooke/dragular/milestones/1","html_url":"https://github.com/luckylooke/dragular/milestones/1.4.0","labels_url":"https://api.github.com/repos/luckylooke/dragular/milestones/1/labels","id":1207631,"number":1,"title":"1.4.0","description":null,"creator":{"login":"luckylooke","id":3660030,"avatar_url":"https://avatars.githubusercontent.com/u/3660030?v=3","gravatar_id":"","url":"https://api.github.com/users/luckylooke","html_url":"https://github.com/luckylooke","followers_url":"https://api.github.com/users/luckylooke/followers","following_url":"https://api.github.com/users/luckylooke/following{/other_user}","gists_url":"https://api.github.com/users/luckylooke/gists{/gist_id}","starred_url":"https://api.github.com/users/luckylooke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckylooke/subscriptions","organizations_url":"https://api.github.com/users/luckylooke/orgs","repos_url":"https://api.github.com/users/luckylooke/repos","events_url":"https://api.github.com/users/luckylooke/events{/privacy}","received_events_url":"https://api.github.com/users/luckylooke/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-07-14T18:33:36Z","updated_at":"2015-07-14T18:33:36Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2015-07-14T01:22:56Z","updated_at":"2015-07-17T06:20:38Z","closed_at":null,"body":"Is it possible to automatically update the original array used by `ng-repeat` when moving items? "},"comment":{"url":"https://api.github.com/repos/luckylooke/dragular/issues/comments/122188877","html_url":"https://github.com/luckylooke/dragular/issues/8#issuecomment-122188877","issue_url":"https://api.github.com/repos/luckylooke/dragular/issues/8","id":122188877,"user":{"login":"jameswyse","id":1144357,"avatar_url":"https://avatars.githubusercontent.com/u/1144357?v=3","gravatar_id":"","url":"https://api.github.com/users/jameswyse","html_url":"https://github.com/jameswyse","followers_url":"https://api.github.com/users/jameswyse/followers","following_url":"https://api.github.com/users/jameswyse/following{/other_user}","gists_url":"https://api.github.com/users/jameswyse/gists{/gist_id}","starred_url":"https://api.github.com/users/jameswyse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameswyse/subscriptions","organizations_url":"https://api.github.com/users/jameswyse/orgs","repos_url":"https://api.github.com/users/jameswyse/repos","events_url":"https://api.github.com/users/jameswyse/events{/privacy}","received_events_url":"https://api.github.com/users/jameswyse/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T06:20:38Z","updated_at":"2015-07-17T06:20:38Z","body":"Yeah that's what I figured :) \r\n\r\nI've kinda got it working in my project by using the events, but it's an ugly hack for sure.. I found that `ngRepeat` really doesn't like losing control of the DOM.. especially when the HTML comments (it uses them as markers) aren't moved with the element! It gets even trickier when you have multiple or nested repeats too :/ \r\n\r\nBasically what i'm doing at the moment is:\r\n\r\non the drag event\r\n- store the original index somewhere so we can remove it from the array when dropped\r\n\r\non the drop event:\r\n- try to find the container array by comparing the DOM indexes\r\n- store the index of the new element inserted by dragular\r\n- remove the element inserted by Dragular from the DOM\r\n- splice the source array to remove the old item\r\n- splice the destination array to insert the item at the correct index\r\n- force ngRepeat to fully re-render - otherwise it goes mental on the next $digest (due to the HTML comments being messed up) \r\n\r\nI'm rushing to deliver this project but I should have some time over the weekend to look at this (if you/someone doesn't get to it first) :)"}}