Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Reactive Forms and"submit" buttons

I'm building a reactive form with Angular, I have obviously a type "submit" button. I have also other buttons elements . But I don't want these buttons to submit the form. How can I achieve that ? I thought without "type='submit'" attribute on button elements, the form wasn't submitted, but it seems not to be the case.

Thanks

like image 422
AntonBoarf Avatar asked Oct 19 '25 03:10

AntonBoarf


2 Answers

Submit button should be of type submit, and every other button that is not used to submit should be type button.

<button type="submit">This is for Submit</button>
<button type="button">Regular Degular button</button>

like image 145
Taranjit Kang Avatar answered Oct 22 '25 05:10

Taranjit Kang


Simple way to do this as:

type ="button"
like image 35
Akj Avatar answered Oct 22 '25 05:10

Akj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!