I have a form which represents an object and an array of sub-objects contained in a repeater. I want to dynamically add sub-objects to the array. When I add a sub-object the form gets submitted unexpectedly.
See this example:
http://plnkr.co/edit/TUblgmb7N710nPL7s5tU?p=preview
My form looks like this:
<form ng-submit="handleSubmit()" ng-controller="TestController">
  <div>Some Input: <input type="text"></div>  
  <div ng-repeat="obj in model.children">
    <input type="text" ng-model="obj.text" />
  </div>
  <button ng-click="addChild()"> Add Child</button>
</form>
The controller looks like this...
Controllers.controller('TestController', ["$scope", function($scope) {
  $scope.model = {
    name: "Some Text",
    children: []
  };
  $scope.handleSubmit = function() {
    alert("Form Submitted!");
  }
  $scope.addChild = function() {
    $scope.model.children.push({text:"Foo"});
  }
}]);
Click the "Add Child" buttton. The UI is updated as expected but the form gets submitted.
I can work around this by putting the submit function in ng-click on the Save button instead of ng-submit on the form but this seems like unexpected behaviour. Can anyone explain?
 
    