dscgt / recycling_website

Admin website for GT OSWM&R.
0 stars 0 forks source link

Add Angular reactive form validators, don't rely on just `required` attribute #41

Closed michaelyfan closed 3 years ago

michaelyfan commented 3 years ago

https://angular.io/guide/reactive-forms#validating-form-input

From the guide: "Caution: Use these HTML5 validation attributes in combination with the built-in validators provided by Angular's reactive forms. Using these in combination prevents errors when the expression is changed after the template has been checked."

We haven't experienced any errors yet, but might in the future.

Needs to be implemented everywhere, for example, checkin-groups.component.html contains required attribute on many <input>'s which are attached to form controls, however, the corresponding controls do not have any validators.

To fully understand this ticket read https://angular.io/guide/reactive-forms in its entirety.

michaelyfan commented 3 years ago

Also: https://angular.io/guide/form-validation

michaelyfan commented 3 years ago

Merged in 0bfd788dce025c985a0acd8c230728f6cb56fe7e, closing.