{"action":"created","issue":{"url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/50","labels_url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/50/comments","events_url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/50/events","html_url":"https://github.com/ghiscoding/angular-validation/issues/50","id":96182997,"number":50,"title":"Questions / Samples?","user":{"login":"tiwarisnehal","id":11294439,"avatar_url":"https://avatars.githubusercontent.com/u/11294439?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwarisnehal","html_url":"https://github.com/tiwarisnehal","followers_url":"https://api.github.com/users/tiwarisnehal/followers","following_url":"https://api.github.com/users/tiwarisnehal/following{/other_user}","gists_url":"https://api.github.com/users/tiwarisnehal/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwarisnehal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwarisnehal/subscriptions","organizations_url":"https://api.github.com/users/tiwarisnehal/orgs","repos_url":"https://api.github.com/users/tiwarisnehal/repos","events_url":"https://api.github.com/users/tiwarisnehal/events{/privacy}","received_events_url":"https://api.github.com/users/tiwarisnehal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-20T22:59:10Z","updated_at":"2015-07-22T04:23:44Z","closed_at":"2015-07-21T23:08:37Z","body":"Hi there. Thanks for providing this module and thanks in advance also for having a look at my questions. Kindly let me know if any of this is possible/doable and link to some samples if you have any.\r\n\r\n1) How to use validationService when using 'Controller as' syntax.\r\n2) I would like to have global configuration at Application level, rather than specify it for each Controller. Is this possible?\r\n3) When using the Directive syntax, can I specify conditional validation. \r\n    i.e. only apply validation when some condition is satisfied.\r\n4) How do I remove Error message/status when some other field changes.\r\n   e.g. In your specified sample @ http://plnkr.co/edit/jADq7H?p=preview\r\n   say when passwords dont match, error is displayed for confirmation field.\r\n   But when user then changes the first password field so that passwords match, then the error should be removed.\r\n5) While I am using 'Controller as vm' syntax, using remote: for validation for a function defined on 'vm' returning a promise, I get error from angular-validation stating 'vm' is undefined. How do I get around this.\r\n\r\nThanks once again.\r\n- Snehal"},"comment":{"url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/comments/123559496","html_url":"https://github.com/ghiscoding/angular-validation/issues/50#issuecomment-123559496","issue_url":"https://api.github.com/repos/ghiscoding/angular-validation/issues/50","id":123559496,"user":{"login":"ghiscoding","id":643976,"avatar_url":"https://avatars.githubusercontent.com/u/643976?v=3","gravatar_id":"","url":"https://api.github.com/users/ghiscoding","html_url":"https://github.com/ghiscoding","followers_url":"https://api.github.com/users/ghiscoding/followers","following_url":"https://api.github.com/users/ghiscoding/following{/other_user}","gists_url":"https://api.github.com/users/ghiscoding/gists{/gist_id}","starred_url":"https://api.github.com/users/ghiscoding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghiscoding/subscriptions","organizations_url":"https://api.github.com/users/ghiscoding/orgs","repos_url":"https://api.github.com/users/ghiscoding/repos","events_url":"https://api.github.com/users/ghiscoding/events{/privacy}","received_events_url":"https://api.github.com/users/ghiscoding/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T04:23:44Z","updated_at":"2015-07-22T04:23:44Z","body":"I was actually curious on how to do your number 4) and 5) and got it easily done. The Angular-Validation library is using exactly the same property as a regular AngularJS built-in library and so you can use the `$invalid` property of each field. For example let say you have a form named `form1` and 3 inputs `input1`, `input2`, `input3`. \r\n\r\nSo let's start with an easy one, let say you want to enable `input2` when `input1` becomes valid. Just simply do the following\r\n```html\r\n<input type=\"text\" name=\"input1\" validation=\"alpha|required\" />\r\n<input type=\"text\" name=\"input2\"  validation=\"alpha|required\" ng-disabled=\"form1.input1.$invalid\" />\r\n```\r\nNow let say you want to enable `input2` only after `input1` is valid but then `input3` only after `input1` and `input2` are valid. You would do something similar to previous code but the input3 will hold a bigger check\r\n```html\r\n<input type=\"text\" name=\"input1\" validation=\"alpha|required\" />\r\n<input type=\"text\" name=\"input2\"  validation=\"alpha|required\" ng-disabled=\"form1.input1.$invalid\" />\r\n<input type=\"text\" name=\"input3\"  validation=\"alpha|required\" ng-disabled=\"form1.input1.$invalid || form1.input2.$invalid\" />\r\n```\r\n\r\nI only tried with 2 inputs and it works great, the 3 inputs should work the way I wrote it, but still haven't tried it. So it's not that hard and it follows the Angular way. Everything that goes inside the `ngDisabled` will be interpreted and the `$invalid` property of each field is the best fit for this.\r\n\r\nHope that helps... no need for the library to do it, you can deal with it directly "}}