
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ngx-forms-validator
Advanced tools
Lightweight and extensible form validation library for Angular applications. Includes custom validators, reusable error messages, and simple integration with reactive forms.
Tiny, fast, and made for Angular Reactive Forms
markFieldsAsDirty and maxLengthWarningInstalling NGX Forms Validator is as simple as running a single command in your Angular project:
npm i ngx-forms-validator
Once installed, you're ready to import the library and start validating forms — no additional setup or dependencies required.
Supports Angular 14 and above — fully compatible with the latest Angular versions.
import { TranslateService } from 'ngx-forms-validator';
constructor(private translateService: TranslateService) {
this.translateService.setTranslationLanguaje('en_US');
}
import { FormValidatorService } from 'ngx-forms-validator';
constructor(public formValidatorService: FormValidatorService) {}
ngOnInit(): void {
this.form = this.formBuilder.group({
name: ['', Validators.required]
});
this.formValidatorService.validateForm(this.form);
}
<form [formGroup]="form">
<div>
<input id="name" name="name" formControlName="name" />
</div>
</form>
this.formValidatorService.validateForm(this.form, {
markFieldsAsDirty: true,
showMaxLengthWarning: true
});
Create your own i18n literals and override the defaults:
export const customLiterals = {
required: 'This field is required',
email: 'Please enter a valid email'
};
this.translateService.setCustomTranslations(customLiterals);
Built-in support for:
Use custom ones included in the lib:
onlyNumber → key: number
hasWhiteSpaceLine → key: whiteSpaceLine
hasLeadingWhiteSpace → key: leadingWhiteSpaceLine
hasTrailingWhiteSpace → key: trailingWhiteSpaceLine
introducedValueExists → key: introducedValueNoExist
maxByte → key: maxLength
Or create your own easily:
export class CustomValidators {
public static noSpecialChars(control: AbstractControl): ValidationErrors | null {
return /[^a-zA-Z0-9]/.test(control.value) ? { noSpecialChars: true } : null;
}
}
Then add its literal key to your custom translations.
To use the default styling, include the stylesheet in your angular.json:
"styles": [
"node_modules/ngx-forms-validator/styles/styles.scss"
]
You can override the styles using .ok-field, .error-field, .warning-field, etc.
You can fine-tune how and when messages appear using:
markFieldsAsDirtyshowMaxLengthWarningFound a bug or want to contribute? Open an issue or PR!
MIT © apalacios.dev
FAQs
Lightweight and extensible form validation library for Angular applications. Includes custom validators, reusable error messages, and simple integration with reactive forms.
The npm package ngx-forms-validator receives a total of 3 weekly downloads. As such, ngx-forms-validator popularity was classified as not popular.
We found that ngx-forms-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.