Implementing File Uploads From Angular to Flask Implementing File Uploads From Angular to Flask flask flask

Implementing File Uploads From Angular to Flask


Form onSubmit handler

To answer your immediate question, what's happening is input type submit in Angular calls the onSubmit method of the form (instead of submitting the form like in plain HTML). And because you don't have a handler for onSubmit in your class, nothing is happening.

For a quick test, follow this link to create a simple onSubmit handler method to test that your submit button works.

Here's a Stackblitz example which logs to console when you click the submit button: https://stackblitz.com/edit/angular-uy481f

File upload

To make file upload work, you would need to make a few things. This touches the component class, creating a new service and injecting it, and updating your form to bind it to the class.

  1. Create a proper Angular form. Here's an example.
  2. Create a method that will handle the onSubmit() of the form.
  3. Create a service that will handle Http calls to upload files.
  4. Inject the service into your class, and call the file upload method of that class.

As you can see, there's a lot involved in making this work unlike having a simple post form in the template. As such, it will be too much for a single answer.

But hopefully, the initial paragraph answered your question and the rest of the answer pointed you in the right direction.