the-moebius / ng-validators Goto Github PK
View Code? Open in Web Editor NEWCollection of input validators for Angular
Collection of input validators for Angular
Hey Moebius, Awesome repo here. I've bene on the hunt for a really well written and documented collection of custom validators for Angular 2+. Are you interested in growing this repo? I would be willing to commit all my custom validators if so.
I'm looking for alpha characters only and numeric characters only validators for name fields.
Something like this for alpha only:
import { FormControl } from '@angular/forms';
export class AlphaOnlyValidator {
static invalidAlphaOnly(control: FormControl): { [key: string]: boolean } {
if (control.value.length && !control.value.match(/^[a-z]+$/i)) {
return { invalidAlphaNumeric: true };
}
return null;
}
}
Hi,
This plugin cause an "AoT build failed" error when compiling a project in production mode.
Output of error :
`typescript error:
Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function,
resolving symbol Injectable in path_to_project/node_modules/@moebius/ng-validators/node_modules/@angular/core/core.d.ts,
resolving symbol ɵi in path_to_project/node_modules/@moebius/ng-validators/node_modules/@angular/forms/forms.d.ts,
resolving symbol ɵi in path_to_project/node_modules/@moebius/ng-validators/node_modules/@angular/forms/forms.d.ts
Error: The Angular AoT build failed.`
Your plugin seems to not been compatible with Angular AoT,
Thank you
I am getting this error on Angular 4+
Expected validator to return Promise or Observable.
Using like this:
this.newPasswordForm = this.formBuilder.group({ password: ['', [Validators.required, Validators.minLength(6)]], password2: ['', [Validators.required, matchOtherValidator("password")]] });
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.