Guides
GuidesExamplesGitterLog In

formly-field

directive

🚧

Internal Directive

Even though you have access to use this directive, general use of angular-formly suggests that you shouldn't have to use it. This directive is used by formly-form. Note, because this is an internal directive, it's API is subject to change without a major version change. You've been warned!

❗️

Misses features outside of formly-form

Most things you specify as options to configure a field are used by this directive, however, some properties about the field (like watchers for example) will simply be ignored. Beware.

Attributes

Attribute NameScope TypeDescription
options= binding (required)The field config. Must have a type OR template OR templateUrl. Everything else is optional, but it is limited to specific properties. Any extra options will result in an error (because angular-formly loves you).
model= binding (required)The model for the field to represent. Most fields will use ng-model="model[options.key]"
form= binding (optional)The NgFormController that will be used to get and set the formControl for the field.
formId= binding (optional)The id of the form, used to generate the id for the field which is used in the name (for the formControl) and the id of the field (useful for a label's for attribute)
index= binding (optional)The index of the field, used if key is not defined on the field.
fields= binding (optional)The other fields. As convenience if needed.
formState= binding (optional)The formly-form.options.formState property. This is how fields can communicate with one another without polluting the model.