So, I've used AngularJS on a few projects now (most recently a MEAN stack project). One part of the project that I wasn't particularly pleased with was the handling of input validation.
I'm soon going to kick off another project which with an AngularJS SPA, communicating with an ASP.NET Web API.
If I have a few requirements:
- Simple input validation throughout (required fields, numerical ranges, date ranges, etc)
- A need for the same validation to be applied through the API and in the AngularJS client
- e.g. a 3rd party client should have the same input validation rules that our AngularJS client has, without the need to (attempt to) replicate them.
How are people solving this, without duplicating input validation logic?
It feels real bad to write all this validation logic twice - once in Web API land, and once in AngularJS land. I've got a few ideas about how to do this, but I'm keen to get some suggestions.
Thanks.