{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/10633","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/10633/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/10633/comments","events_url":"https://api.github.com/repos/angular/angular/issues/10633/events","html_url":"https://github.com/angular/angular/issues/10633","id":170369180,"number":10633,"title":"Have an access to 'formControlName' value inside a custom validation function","user":{"login":"mlc-mlapis","id":5693835,"avatar_url":"https://avatars.githubusercontent.com/u/5693835?v=3","gravatar_id":"","url":"https://api.github.com/users/mlc-mlapis","html_url":"https://github.com/mlc-mlapis","followers_url":"https://api.github.com/users/mlc-mlapis/followers","following_url":"https://api.github.com/users/mlc-mlapis/following{/other_user}","gists_url":"https://api.github.com/users/mlc-mlapis/gists{/gist_id}","starred_url":"https://api.github.com/users/mlc-mlapis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlc-mlapis/subscriptions","organizations_url":"https://api.github.com/users/mlc-mlapis/orgs","repos_url":"https://api.github.com/users/mlc-mlapis/repos","events_url":"https://api.github.com/users/mlc-mlapis/events{/privacy}","received_events_url":"https://api.github.com/users/mlc-mlapis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20forms","name":"comp: forms","color":"c5def5"},{"url":"https://api.github.com/repos/angular/angular/labels/flag:%20can%20be%20closed?","name":"flag: can be closed?","color":"bfdadc"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Need%20repro","name":"state: Need repro","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-10T09:13:23Z","updated_at":"2016-10-12T18:50:59Z","closed_at":"2016-10-12T18:50:59Z","body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[ ] bug report\r\n[x] feature request\r\n[ ] support request\r\n```\r\n\r\n**Current behavior**\r\nThere is no way how to get the value of 'formControlName' inside a custom validation function to identify which control is beeing actually validated (model-driven forms) because the only parameter is (c: FormControl) and the actual API of 'FormControl' is:\r\n```\r\n_errors, _onChange, _parent, _pristine, _status, _statusChanges, _touched,\r\n_value, _valueChanges, asyncValidator, dirty, errors, pending, pristine,\r\nroot, status, statusChanges, touched, untouched, valid, validator, value, valueChanges\r\n```\r\n\r\n**Expected/desired behavior**\r\nBe able to get 'formControlName' value inside a custom validation and generic function and use it as the identity of the actually validated control. It allows to have a dynamic set of validation rules for each control (for example in JSON syntax) that could be maintenated outside of the app code then.\r\n\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nTo be more flexible and minimize the code = reducing the number of custom validators.\r\n\r\n**Please tell us about your environment:**\r\n\r\n* **Angular version:** 2.0.0-rc.4\r\n \r\n* **Browser:** [all] \r\n \r\n* **Language:** [all] \r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/253303701","html_url":"https://github.com/angular/angular/issues/10633#issuecomment-253303701","issue_url":"https://api.github.com/repos/angular/angular/issues/10633","id":253303701,"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},"created_at":"2016-10-12T18:50:58Z","updated_at":"2016-10-12T18:50:58Z","body":"@mlc-mlapis If your control depends on sibling control(s), chances are the validator should be moved up a level to the parent, where you do have access to names.  Or as @zoechi mentioned, you can wrap the validator. If you have a use case where this won't work, please open a new issue with a detailed description and a plunker. Without these, it's hard to evaluate the necessity of this feature request."}}
{"actor":{"display_login":"kara"}}