{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/9228","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/9228/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/9228/comments","events_url":"https://api.github.com/repos/angular/angular/issues/9228/events","html_url":"https://github.com/angular/angular/pull/9228","id":160528308,"number":9228,"title":"feat(radio): support radio button sharing a control","user":{"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},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/cla:%20yes","name":"cla: yes","color":"009800"},{"url":"https://api.github.com/repos/angular/angular/labels/pr_state:%20LGTM","name":"pr_state: LGTM","color":"009800"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-06-15T21:28:36Z","updated_at":"2016-08-05T11:17:26Z","closed_at":"2016-06-15T22:28:05Z","pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/9228","html_url":"https://github.com/angular/angular/pull/9228","diff_url":"https://github.com/angular/angular/pull/9228.diff","patch_url":"https://github.com/angular/angular/pull/9228.patch"},"body":"This PR adds the ability for radio buttons to share a `FormControl` instance.  This means you no longer need to create a RadioButtonState to manage radio buttons.  \r\n\r\n**Before**:\r\n\r\n```html\r\n<form #f=\"ngForm\">\r\n   <input type=\"radio\" name=\"food\" [(ngModel)]=\"foodChicken\">\r\n   <input type=\"radio\" name=\"food\" [(ngModel)]=\"foodFish\">\r\n</form>\r\n\r\n{{ f. value | json }}      // { foodChicken: {value: 'chicken', checked: false}, foodFish: {value: 'fish', checked: true} }\r\n```\r\n\r\n```ts\r\nclass MyComp {\r\n   foodChicken = new RadioButtonState(false, 'chicken');\r\n   foodFish = new RadioButtonState(true, 'fish');\r\n}\r\n```\r\n\r\n**After**:\r\n\r\n```html\r\n<form #f=\"ngForm\">\r\n   <input type=\"radio\" name=\"food\" [(ngModel)]=\"food\" value=\"chicken\">\r\n   <input type=\"radio\" name=\"food\" [(ngModel)]=\"food\" value=\"fish\">\r\n</form>\r\n\r\n{{ f. value | json }}      // { food: 'fish' }\r\n```\r\n\r\n```ts\r\nclass MyComp {\r\n   food = 'fish';\r\n}\r\n```\r\n\r\nNote: this change will land probably in RC.3, not RC.2.\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/237825782","html_url":"https://github.com/angular/angular/pull/9228#issuecomment-237825782","issue_url":"https://api.github.com/repos/angular/angular/issues/9228","id":237825782,"user":{"login":"fatema-k","id":5979360,"avatar_url":"https://avatars.githubusercontent.com/u/5979360?v=3","gravatar_id":"","url":"https://api.github.com/users/fatema-k","html_url":"https://github.com/fatema-k","followers_url":"https://api.github.com/users/fatema-k/followers","following_url":"https://api.github.com/users/fatema-k/following{/other_user}","gists_url":"https://api.github.com/users/fatema-k/gists{/gist_id}","starred_url":"https://api.github.com/users/fatema-k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatema-k/subscriptions","organizations_url":"https://api.github.com/users/fatema-k/orgs","repos_url":"https://api.github.com/users/fatema-k/repos","events_url":"https://api.github.com/users/fatema-k/events{/privacy}","received_events_url":"https://api.github.com/users/fatema-k/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T11:17:26Z","updated_at":"2016-08-05T11:17:26Z","body":"@kara Can you please share a code sample for implementing Validation on radio buttons? I still get the error TypeError: Cannot read property 'value' of undefined\r\nat RadioControlValueAccessor.onChange. I am using RC4. Following is my code snippet:\r\n\r\n```\r\n<div class=\"col-lg-5 col-md-5 margin-bottom-10\" >\r\n                                    <b><input type=\"radio\" name=\"PropertyControl\" ngControl=\"propertyControl\" [ngModel]=\"complianceOba.PropertyControl\" (click)=\"complianceOba.PropertyControl='1'\" value=\"1\"> Yes&nbsp;&nbsp;&nbsp;\r\n                                    <input type=\"radio\" name=\"PropertyControl\" ngControl=\"propertyControl\" [ngModel]=\"complianceOba.PropertyControl\" (click)=\"complianceOba.PropertyControl='0'\" value=\"0\"> No</b>\r\n                                    <em *ngIf=\"!propertyControl.valid && submitAttempt\" class=\"displayBlock\">Please mention your choice.</em>\r\n                                </div>\r\n```\r\n\r\n\r\nts code:\r\n\r\n`this.propertyControl = new Control('', Validators.required);`\r\n"}}
{"actor":{"display_login":"fatema-k"}}