title: How to handle multiple submit buttons in a form using Angular JS?
body: <p>I'm using AngularJS and I have a form where the user can enter data. At the end of the form I want to have two buttons, one to "save" which will save and go to another page, and another button labeled "save and add another" which will save the form and then reset it - allowing them to enter another entry.</p>
  
  <p>How do I accomplish this in angular? I was thinking I could have two submit buttons with ng-click tags, but I'm using ng-submit on the form element. Is there any reason I NEED to be using ng-submit - I can't remember why I started using that instead of ng-click on the button.</p>
  
  <p>The code looks something like:</p>
  
  <pre><code>&lt;div ng-controller="SomeController"&gt;
      &lt;form ng-submit="save(record)"&gt;
          &lt;input type="text" name="shoppingListItem" ng-model="record.shoppingListItem"&gt;
          &lt;button type="submit"&gt;Save&lt;/button&gt;
          &lt;button type="submit"&gt;Save and Add Another&lt;/button&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And in the controller <code>SomeController</code></p>
  
  <pre><code>$scope.record = {};
  $scope.save = function (record) {
      $http.post('/api/save', record).
          success(function(data) {
              // take action based off which submit button pressed
          });
  }
  </code></pre>