{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/binding/issues/145","labels_url":"https://api.github.com/repos/aurelia/binding/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/binding/issues/145/comments","events_url":"https://api.github.com/repos/aurelia/binding/issues/145/events","html_url":"https://github.com/aurelia/binding/issues/145","id":99577583,"number":145,"title":"$index used in delegate not updating when used with $parent.array[$index] strategy","user":{"login":"davismj","id":3845823,"avatar_url":"https://avatars.githubusercontent.com/u/3845823?v=3","gravatar_id":"","url":"https://api.github.com/users/davismj","html_url":"https://github.com/davismj","followers_url":"https://api.github.com/users/davismj/followers","following_url":"https://api.github.com/users/davismj/following{/other_user}","gists_url":"https://api.github.com/users/davismj/gists{/gist_id}","starred_url":"https://api.github.com/users/davismj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davismj/subscriptions","organizations_url":"https://api.github.com/users/davismj/orgs","repos_url":"https://api.github.com/users/davismj/repos","events_url":"https://api.github.com/users/davismj/events{/privacy}","received_events_url":"https://api.github.com/users/davismj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/binding/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-07T04:35:40Z","updated_at":"2015-09-29T08:55:48Z","closed_at":null,"body":"I have a `repeat.for=\"item of items\"` block that contains a `value.bind=\"$parent.array[$index]\"` binding as well as a `click.delegate=\"handler($index)` binding. If I have say 5 items, remove the first one, and then invoke the click handler on the last item, the argument passed to the function is still 5. If I remove the value binding, however, the click handler works as expected."},"comment":{"url":"https://api.github.com/repos/aurelia/binding/issues/comments/143993688","html_url":"https://github.com/aurelia/binding/issues/145#issuecomment-143993688","issue_url":"https://api.github.com/repos/aurelia/binding/issues/145","id":143993688,"user":{"login":"martingust","id":5166897,"avatar_url":"https://avatars.githubusercontent.com/u/5166897?v=3","gravatar_id":"","url":"https://api.github.com/users/martingust","html_url":"https://github.com/martingust","followers_url":"https://api.github.com/users/martingust/followers","following_url":"https://api.github.com/users/martingust/following{/other_user}","gists_url":"https://api.github.com/users/martingust/gists{/gist_id}","starred_url":"https://api.github.com/users/martingust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martingust/subscriptions","organizations_url":"https://api.github.com/users/martingust/orgs","repos_url":"https://api.github.com/users/martingust/repos","events_url":"https://api.github.com/users/martingust/events{/privacy}","received_events_url":"https://api.github.com/users/martingust/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T08:55:48Z","updated_at":"2015-09-29T08:55:48Z","body":"@davismj I'm trying to reproduce this but I must be missing something. Here is what I've got\r\n\r\n**View**\r\n```\r\n<button click.delegate=\"removeFirst()\">Remove First</button>\r\n    <ul>\r\n      <li repeat.for=\"item of items\">\r\n        <input value.bind=\"$parent.items[$index]\" click.delegate=\"$parent.handler($index)\" />\r\n      </li>\r\n    </ul>\r\n```\r\n\r\n**ViewModel**\r\n```\r\nitems = ['foo', 'qux', 'bar'];\r\n\r\nhandler(index){\r\n    console.log(index);\r\n}\r\n\r\nremoveFirst(){\r\n    this.items.splice(0, 1);\r\n}\r\n```\r\n\r\nWhen I remove first item and then click inside of the second input to invoke `handler()` I get expected `1` in the console."}}