I have an AngularJS form which looks like this:
<form ng-submit="vm.update(vm.model)">
.. fields
<button ng-click="vm.addCluster()">Add</button>
.. more fields
<input type="submit" value="Save" />
</form>
When I click submit it works as expected - update()
method is called. When I click the button it calls addCluster()
but after that the form gets submitted and update()
is called automatically.
Why does it do It and how can I prevent this?