JoHksi JoHksi - 5 months ago 14
AngularJS Question

Inserting a button inside a form and triggering different actions in an Angular app

I'm making a web app. I'm in the middle of implementing the Braintree and everything works fine. Now I have an issue with the view code for Braintree. Below is an essential view code I need for braintree integration:

<form name="form" ng-submit="submitPayment()">
<div id="payment-form"></div>
<input type="submit" class="button button-form-success button--primary vertical-offset--small" value="Pay">
</form>


Now, I am trying to add another button next to
pay
button, but whenever I put the button in the form, it triggers
submitPayment()
instead of button's action. How do I successfully add a button inside the form and trigger different function when clicked?

Answer

Just use a tag for that like below

<a href="" class="button button-form-success button--primary vertical-offset--small">Second Button</a>
Comments