Defines a generic validator for Angular 2 Reactive Forms
The generic validator resides in shared/generic-validator.ts. The customer component is provided as an example usage of the generic validator.
Defines a generic validator for Angular 2 Reactive Forms
License: MIT License
Hi @DeborahK the genericValidator looks super cool, and I was keen to use this. However while doing a deep dive in the code, I noticed that you subscribe in an ngAfterViewInit method, and in it we fetch all the controls using a @ViewChildren to get the form elements and also subscribe to their Blur Events observable.
If we now have a Form Array and are adding extra tags, then as the component class is already created, our formInputElements will not get updated, and we will not be doing any validation on the newly added Form Controls, and so they will miss out on being validated by the genericValidator.
It may be possible to unsubscribe and then resubscribe each time you add a control, but this didn't feel ideal either.
Anyhow, this may be a possible gotcha, and therefore perhaps worth pointing out in the Read Me.
Really good generic validator but it does not seem to work with form-arrays. Even if it did how would the user identify the correct error message to display as there would be multiple formcontrols with the same name
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.