It isn't a form generator. You build your form normaly and associate to a schema, and all valitations will be ready to use.
The program uses a declarative way to express the user interface and application behavior. Thus, the business rules are defined in the View in HTML form. Is not good because these rules are mixed with the presentation layer.
Using Mongoose Schemas to define the Business Rules, it is not needed to repeat the validations rules in each form. All rules are in one place, in an Angular service.
It is the same as:
The schema can be used to define elements atributes like:
Assessors and Modifiers
virtual(default in Mongoose)
parser(for use in Angular forms)
- If a attribute is defined in the form, it won't be overwritten for the schema value. So, the rules can be customised in a specific form, if it is needed.
- Both HTML5 constraints and Angular constraints are defined. If there is the
maxlengthin the schema, the attributes
maxlengthare defined. If necessary, use the attribute
novalidatein the form to stop HTML5 validation.
- The Mongoose schema is extended to accept string Types, formatters, parsers and pattern.
- The attributes
formatcan be used to help in another directives.
- More tests