Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<meta charset=utf-8 />
<title>ng-form</title>
</head>
<body>
  <div ng-controller="MyCtrl">
    <form name="test_form" ng-submit="submit()">
      <ng-form ng-repeat="key in keys" name="keyForm">
        姓名:<input type="text" name="input_name" ng-model="key.name" required>
        年齡:<input type="text" name="input_age" ng-model="key.age" required>
        <br>
      </ng-form>
      <input type="submit" value="新增" ng-click="addKey()"/>  
      <input type="submit" value="儲存" />
    </form>
    <br>  
    {{keys}}
  </div>  
</body>
</html>
 
function MyCtrl($scope){
  
  $scope.keys = [];
  $scope.keys.push({ name: 'ANNA',age:18});
  $scope.addKey = function () {
    $scope.keys.push({ name: '',age:null});
    };
  $scope.submit = function () {
        console.log($scope.keys);
    };
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
annaismepro
0viewers