One of the mistake which I see often during development on the frontend side is the cancel button, which actually submits the form when clicked. Saw it once, wait a while, saw it again, wait a while, saw it again, and the loop continues. Some people doesn’t even realize.
So what’s the problem? Let’s take a look at a normal html form in AngularJS. HTML Code
<div ng-app="MyApp">
<div ng-controller="MyController">
<form ng-submit="submitTheForm()">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" ng-model="someone.name" id="name" placeholder="Enter name"></input>
</div>
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
JavaScript Code