Angular: ng-repeat forms 14583252
http://angularjs.org/
by mynameisdonald
HTML
<div ng-controller="MyCtrl">
<form name="test_form" ng-submit="submit()">
<ng-form ng-repeat="key in keys" name="keyForm">
<input type="text" name="data_input" ng-model="key.data" required>
</ng-form>
<a ng-click="addKey()">NEW KEY</a>
<input type="submit" />
</form>
keys={{keys}}
</div>
JavaScript
var myApp = angular.module('myApp', []);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.keys = [];
$scope.addKey = function () {
$scope.keys.push({ data: ''});
}
$scope.submit = function () {
console.log($scope);
}
}