Better, cleaner, and more maintainable reactive form utilities for Angular.
- 🧩 Conditional validators for complex reactive forms
- ⚡ Utility methods to simplify control management
- 🧪 100% unit tested
https://bioroxx.github.io/ngx-better-forms
npm install @ngx-better-forms/better-formsSee short examples below.
You can find a full feature showcase in the documentation.
Add validators to a target FormControl, based on the current value of another FormControl.
formGroup = this.formBuilder.group(
{
field1: new FormControl<string>(''),
target: new FormControl<string>(''),
},
{
validators: [
BetterValidation.conditionalValidators({
targetControlPath: 'target',
targetValidators: [Validators.required],
conditions: [
{
controlPath: 'field1',
testValues: ['a', 'b'],
},
],
}),
],
},
);formGroup = this.formBuilder.group(
{
field1: new FormControl<string>(''),
target: new FormControl<string>(''),
},
{
validators: [
BetterDisable.conditionalDisable({
targetControlPath: 'target',
conditions: [
{
controlPath: 'field1',
testValues: ['a', 'b'],
},
],
}),
],
},
);
⚠️ Disclaimer:
This library is currently in very early development.
Features, APIs, and behavior may change without notice — use with caution, but be inspired. ✨