{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/9275","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/9275/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/9275/comments","events_url":"https://api.github.com/repos/angular/angular/issues/9275/events","html_url":"https://github.com/angular/angular/issues/9275","id":160739796,"number":9275,"title":"state of the checkbox not getting updated even after its ng-model value is updated","user":{"login":"IamKritika","id":13914948,"avatar_url":"https://avatars.githubusercontent.com/u/13914948?v=3","gravatar_id":"","url":"https://api.github.com/users/IamKritika","html_url":"https://github.com/IamKritika","followers_url":"https://api.github.com/users/IamKritika/followers","following_url":"https://api.github.com/users/IamKritika/following{/other_user}","gists_url":"https://api.github.com/users/IamKritika/gists{/gist_id}","starred_url":"https://api.github.com/users/IamKritika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IamKritika/subscriptions","organizations_url":"https://api.github.com/users/IamKritika/orgs","repos_url":"https://api.github.com/users/IamKritika/repos","events_url":"https://api.github.com/users/IamKritika/events{/privacy}","received_events_url":"https://api.github.com/users/IamKritika/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/action:%20review","name":"action: review","color":"ededed"},{"url":"https://api.github.com/repos/angular/angular/labels/need:%20repro","name":"need: repro","color":"006b75"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Blocked","name":"state: Blocked","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"kara","id":3871688,"avatar_url":"https://avatars.githubusercontent.com/u/3871688?v=3","gravatar_id":"","url":"https://api.github.com/users/kara","html_url":"https://github.com/kara","followers_url":"https://api.github.com/users/kara/followers","following_url":"https://api.github.com/users/kara/following{/other_user}","gists_url":"https://api.github.com/users/kara/gists{/gist_id}","starred_url":"https://api.github.com/users/kara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kara/subscriptions","organizations_url":"https://api.github.com/users/kara/orgs","repos_url":"https://api.github.com/users/kara/repos","events_url":"https://api.github.com/users/kara/events{/privacy}","received_events_url":"https://api.github.com/users/kara/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/angular/angular/milestones/62","html_url":"https://github.com/angular/angular/milestones/2.0.0-rc.3","labels_url":"https://api.github.com/repos/angular/angular/milestones/62/labels","id":1831054,"number":62,"title":"2.0.0-rc.3","description":"","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":4,"state":"open","created_at":"2016-06-15T23:19:22Z","updated_at":"2016-06-17T17:17:22Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-06-16T19:23:47Z","updated_at":"2016-06-17T18:36:07Z","closed_at":null,"body":"* **I'm submitting a bug for state of the checkbox not getting updated even after its ng-model value is updated**\r\n- [ ] bug report\r\n\r\n**Current behavior**\r\nIf you try and update the ngModel of a checkbox in say ngModelChange method, the ngModel value is updated but the checkbox still remains in previous state.\r\n\r\n**Expected/desired behavior**\r\nThe state of checkbox should change as ngModel value changes.\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\nI am trying to implement \"select all\" checkbox through angular 2. \r\n\r\nI have a list of checkboxes and one select all checkbox. And in my use case it's so that if user checks all checkboxes from the list manually , I have to uncheck all the checkboxes from the list and check the \"All\" checkbox. So I have binded a ngModel and ngModelChange to all the checkboxes .Now what happens is if I try to update the ngModel in the ngModelChange method ,the state of checkbox is not changed even though the ngModel value is updated (since angular2 listens to events only and not to change in value of ngModel). I have tried to achieve this through the attribute directive as well but nothing seems to work.\r\n\r\n* **Angular version:** 2.0.0-beta.X \r\n \r\n* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] \r\n \r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5 | Dart] \r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/226847587","html_url":"https://github.com/angular/angular/issues/9275#issuecomment-226847587","issue_url":"https://api.github.com/repos/angular/angular/issues/9275","id":226847587,"user":{"login":"zoechi","id":405837,"avatar_url":"https://avatars.githubusercontent.com/u/405837?v=3","gravatar_id":"","url":"https://api.github.com/users/zoechi","html_url":"https://github.com/zoechi","followers_url":"https://api.github.com/users/zoechi/followers","following_url":"https://api.github.com/users/zoechi/following{/other_user}","gists_url":"https://api.github.com/users/zoechi/gists{/gist_id}","starred_url":"https://api.github.com/users/zoechi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoechi/subscriptions","organizations_url":"https://api.github.com/users/zoechi/orgs","repos_url":"https://api.github.com/users/zoechi/repos","events_url":"https://api.github.com/users/zoechi/events{/privacy}","received_events_url":"https://api.github.com/users/zoechi/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T18:36:07Z","updated_at":"2016-06-17T18:36:07Z","body":"I think this is caused by change detection not seeing a change if the value is changed and immediately restored before change detection has a chance to run and detect the change. This is the reason the \"new\" value is not propagated back to the checkbox. The checkbox updates itself and Angular doesn't see a change that would make it necessary to propagate back to the checkbox. \r\n\r\nIf you explicitly invoke change detection before the value is reset, then change detection kicks in (same with `setTimeout()`)\r\n\r\nI think this is by design."}}
{"actor":{"display_login":"zoechi"}}