We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Form Validation Done Right | Ward Bell | ng-cof 2022
"Learn best practices for form validation from Ward Bell at ng-cof 2022, covering topics like abstraction, scalability, and maintainability in a scalable and efficient approach."
- Write less, do more. Avoid boilerplate code and focus on application logic.
- The model should know the validation rules, not the UI.
- Use a directive to bind the form control to the validator.
- One validation engine and set of rules for the entire application.
- Write custom validations once and reuse them throughout the application.
- Use a factory to create validators and avoid code duplication.
- Avoid writing unit tests for each validation rule.
- Expose errors at the field level and provide a clear path for fixing issues.
- Remove unnecessary requirements and focus on the application’s core logic.
- Use a scalable and maintainable architecture.
- Model validation should be done at the server-side, not just the client-side.
- Validate data integrity at the server-side, not just the client-side.
- Provide a clear and concise error message to the user.
- Use a validation suite to centralize and manage validation rules.