I have a set of fields in a form that have the same subsets of fields. I want be able to add and remove multiple subsets in these sets. The fields are stored as arrays and generated with ngRepeat. I have buttons with ngClick to add to the array of these field sets. These functions would be identical except for the array name I want to add to. I want to pass a variable with ngInit on every button push to the function that adds to the array. What would be the correct way to do this?
my form:
<div ng-repeat="1 in Array1" ng-init="addBtn = '1'"></div>
<a ng-click="add(addBtn)" href=""></a>
<div ng-repeat="2 in Array2" ng-init="addBtn = '2'"></div>
<a ng-click="add(addBtn)" href=""></a>
<div ng-repeat="3 in Array3" ng-init="addBtn = '3'"></div>
<a ng-click="add(addBtn)" href=""></a>
my controller:
// add fieldset to form
$scope.add = function add (addBtn) {
$scope.something.other. + addBtn + .push({
fields: ''
});
};