Skip to content

Conceptual overview

Chris Knight edited this page Jul 23, 2018 · 2 revisions

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.

High Level Concepts

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

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

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

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

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.

Clone this wiki locally