-
Notifications
You must be signed in to change notification settings - Fork 3
Conceptual overview
ng-form-rules
makes working with Angular reactive forms easier by providing a simple, powerful, and customizable rule engine library. You describe your data structure, rules, and logic, and we will create a form that hooks it all together for you.
The following sections serve as a high level overview of each conceptual area. For a more detailed look into each concept please see its corresponding page.
Model settings are the top level construct in ng-form-rules
. A model setting describes the structure and functionality of your form via properties you add to it. You will use a model settings instance to generate a FormGroup
, which will be configured with all the form controls, validators, async validators, etc. you configure. This generated form group is what you will use in your templates.
Learn more about model settings.
Properties represent the controls that will be in your form. When a form group is created from a model settings instance, each property in the model setting will be generated as either a FormControl
, FormGroup
, or FormArray
depending on how the property was configured.
Learn more about properties.
Tests dictate if a property is valid and/or editable. Each property can have a group of tests that control its validity and a group of tests that control its editability. These tests listen for value changes and execute the test's rule set(s). If the property's validation tests fail then its form control is marked as invalid and the control's errors
value is updated with the tests validation information. If the property's editability tests fail then its control is disabled.
Learn more about tests.
Rule sets dictate whether a test passes or fails. Rule sets can have synchronous or asynchronous logic that looks at the state of the form data and determines if the test should pass.
Learn more about rule sets.
Is there something missing from the documentation? Do you see a problem with the documentation? Add a new issue and we will get to work on it. Or better yet, submit a pull request. Thank you!