{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Validation","type":"basic","slug":"validation","excerpt":"","body":"[egghead.io lesson](https://egghead.io/lessons/angularjs-angular-formly-custom-validation?pl=7) | [custom validators](http://angular-formly.com/#/example/advanced/validators) | [integration with is.js](http://angular-formly.com/#/example/integrations/is-js)\n\nYou can specify custom validation in your JSON. See the property called `validators` on your field config in [formly-form](doc:formly-form) for more information on this.\n\nFormly uses angular's built-in validation mechanisms. See the [angular docs](https://docs.angularjs.org/guide/forms) for more information on this. (Note, if you're using Angular 1.3, formly utilizies the new `$validators` and `$asyncValidators` pipelines, otherwise, it falls back to good old `$parsers`. Either way, your API with formly is the same, including asynchornous validation with 1.2.x!!!! <-- this is a big deal).\n\nThe form controller is bound to what you specify as the `form` attribute on the `formly-form` directive. Formly will add a `formControl` property to the field, and you can reference that in your template with `options.formControl` to get access to properties like `$invalid` or `$error`. See the bootstrap templates for an example. Note, there's also a shortcut called `fc` on the `formly-field` scope so you have access to it in your templates.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Learn the nuances of <ng-form> / <form> / <formly-form>\",\n  \"body\": \"There are some interesting things you should be aware of when dealing with the different forms with angular. See a decently in-depth explination here: http://jsbin.com/mepega/edit?html,output\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"No built-in validators\",\n  \"body\": \"Angular does some validation itself depending on an input's type, but angular-formly doesn't actually ship with any pre-defined validators. You will need to define your own.\"\n}\n[/block]","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"558cb2bd0b236c2500d37cf7","project":"5515ba4981faf83900d2b10c","createdAt":"2015-03-30T18:42:50.729Z","githubsync":"","version":{"version":"6.16.0","version_clean":"6.16.0","codename":"","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["558cb2bc0b236c2500d37cd5","558cb2bc0b236c2500d37cd6","558cb2bc0b236c2500d37cd7","558cb2bc0b236c2500d37cd8","558cb2bc0b236c2500d37cd9","558cb2bc0b236c2500d37cda"],"_id":"558cb2bc0b236c2500d37cd4","project":"5515ba4981faf83900d2b10c","releaseDate":"2015-06-26T02:02:36.211Z","__v":1,"createdAt":"2015-06-26T02:02:36.211Z","forked_from":"558a9c9f8d30cb2300873ecd"},"__v":0,"user":"54e3723b8ef7552300409bf4","category":{"sync":{"isSync":false,"url":""},"pages":["558cb2bd0b236c2500d37cf0","558cb2bd0b236c2500d37cf1","558cb2bd0b236c2500d37cf2","558cb2bd0b236c2500d37cf3","558cb2bd0b236c2500d37cf4","558cb2bd0b236c2500d37cf5","558cb2bd0b236c2500d37cf6","558cb2bd0b236c2500d37cf7","558cb2bd0b236c2500d37cf8","558cb2bd0b236c2500d37cf9","558cb2bd0b236c2500d37cfa","558cb2bd0b236c2500d37cfb","558cb2bd0b236c2500d37cfc","558cb2bd0b236c2500d37cfd"],"title":"Guides","slug":"guides","order":0,"from_sync":false,"reference":false,"_id":"558cb2bc0b236c2500d37cd5","__v":1,"version":"558cb2bc0b236c2500d37cd4","createdAt":"2015-03-27T20:15:06.295Z","project":"5515ba4981faf83900d2b10c"}}
[egghead.io lesson](https://egghead.io/lessons/angularjs-angular-formly-custom-validation?pl=7) | [custom validators](http://angular-formly.com/#/example/advanced/validators) | [integration with is.js](http://angular-formly.com/#/example/integrations/is-js) You can specify custom validation in your JSON. See the property called `validators` on your field config in [formly-form](doc:formly-form) for more information on this. Formly uses angular's built-in validation mechanisms. See the [angular docs](https://docs.angularjs.org/guide/forms) for more information on this. (Note, if you're using Angular 1.3, formly utilizies the new `$validators` and `$asyncValidators` pipelines, otherwise, it falls back to good old `$parsers`. Either way, your API with formly is the same, including asynchornous validation with 1.2.x!!!! <-- this is a big deal). The form controller is bound to what you specify as the `form` attribute on the `formly-form` directive. Formly will add a `formControl` property to the field, and you can reference that in your template with `options.formControl` to get access to properties like `$invalid` or `$error`. See the bootstrap templates for an example. Note, there's also a shortcut called `fc` on the `formly-field` scope so you have access to it in your templates. [block:callout] { "type": "warning", "title": "Learn the nuances of <ng-form> / <form> / <formly-form>", "body": "There are some interesting things you should be aware of when dealing with the different forms with angular. See a decently in-depth explination here: http://jsbin.com/mepega/edit?html,output" } [/block] [block:callout] { "type": "info", "title": "No built-in validators", "body": "Angular does some validation itself depending on an input's type, but angular-formly doesn't actually ship with any pre-defined validators. You will need to define your own." } [/block]