You can use the Upload in template-driven or reactive forms.
The component supports the
required built-in Angular validation and builds on top of that with custom
restrictions for file extensions, minimum, and maximum file size.
The template-driven forms enable you to bind the Upload to the model by using the
The following example demonstrates how to utilize the
required validation and the
restrictions configuration option. With these settings in place, the form will become valid when an image file is successfully uploaded.
FormGroup provides a way to render reactive forms. For more details, refer to the Angular Documentation.
The following example demonstrates how to use the Upload in a reactive form.
The following example demonstrates how to use the Upload within a
FormField component and provide hint and error messages.