Class-validator: Example for use this awesome module in angular 2 form validation.

Created on 16 Feb 2017  路  3Comments  路  Source: typestack/class-validator

There is a way to avoid writing all the rules again?

documentation

Most helpful comment

Hi,
I created a simple angular 2 custom validator for my purposes.
The validator uses this class-validator lib to validate the form control.

You can find the source code here:
DynaValidator
and the complete example project here:
Example-Dynamic-Form-And-Validation

I know it is not perfect or really performant, but it works for my use case.

I hope there is a better solution soon.

All 3 comments

Hi,
I created a simple angular 2 custom validator for my purposes.
The validator uses this class-validator lib to validate the form control.

You can find the source code here:
DynaValidator
and the complete example project here:
Example-Dynamic-Form-And-Validation

I know it is not perfect or really performant, but it works for my use case.

I hope there is a better solution soon.

Wow that's very interesting !!!

I was thinking of having this kind of validation which is somehow not attached to Angular but consumed by it. This way, the same model class can be used server side for validation.

Good job!

@mesche Congratulations on your work. It was excellent! Your code will help me a lot. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isergey picture isergey  路  3Comments

pietrobelluno picture pietrobelluno  路  3Comments

Eldar-X picture Eldar-X  路  3Comments

AndyBarron picture AndyBarron  路  3Comments

otbe picture otbe  路  5Comments