Validation
You can specify custom validation in your JSON. See the property called validators
on your field config in formly-form for more information on this.
Formly uses angular's built-in validation mechanisms. See the angular docs 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.
Updated less than a minute ago