To ensure that only one button performs the submit function, you can set the other button’s type attribute value to “button”. This prevents the other button from submitting the form. Here is an example:

<form (ngSubmit)="onSubmit()"> 
  <!-- Button that submits the form -->
  <button type="submit">Submit</button>

  <!-- Button that has no submit function -->
  <button type="button">Nicht senden</button>
</form>

Adding type=”button” to the second button prevents it from submitting the form. Instead, it can be used for other actions, such as resetting the form or cancel, or..or…or… 🙂 .

By Shabazz

Software Engineer, MCSD, Web developer & Angular specialist

Leave a Reply

Your email address will not be published. Required fields are marked *