I am working on Angular 7 forms. I made a whole form with all fields and just added a simple button at the end of this form and now I am wondering how the click on this button is firing the submit action. I have not even set the attribute type="submit" for this button. I have
(ngSubmit)="onSubmit(employeeForm)"
at the top of my form. Can someone make me understand how any random button is firing this submit functionality. Thanks already.
P.S. I am using Material Design controls in this form.
submit
is just a form event, which can be fired using a button withtype="submit"
inside the form element. This functionality is simply provided by HTML, it's not Angular specific. – Tushar Walzade