I was trying to add both input fields and corresponding radio buttons to my project using angularJS. Means when I click add, it will create one input field and 3 corresponding radio buttons together, as below picture. I could able to add input fields successfully when I click add. But having trouble in creating radio buttons also when I click add the iput field's placeholder should display input 1 and when click add again should display input 2 like that. Can someone help me on it. Following is my code.
Html portion:
<table class="table">
<tr class="tr_class">
<td></td>
<td></td>
<td align="center"><b>functional check </b></td>
<td align="center"><b>XXissue</b></td>
<td align="center"><b>YY risk</b></td>
</tr>
<tr class="tr_class">
<td class="td_class"><div class="input-group">
<span class="input-group-addon">input 1</span>
<input type="text" class="form-control" placeholder="input 1">
</div> <br/></td>
<td> </td>
<td align="center"><input type="radio" name="a1"></td>
<td align="center"><input type="radio" name="a1"></td>
<td align="center"><input type="radio" name="a1"></td>
</tr>
<tr>
<td><div class="input-group">
<span class="input-group-addon">Check2</span>
<input type="text" class="form-control" placeholder="input 2">
</div> <br/></td>
<td></td>
<td align="center"><input type="radio" name="a2"></td>
<td align="center"><input type="radio" name="a2" ></td>
<td align="center"><input type="radio" name="a2" ></td>
</tr>
<tr>
<td><div class="input-group">
<span class="input-group-addon">input 3</span>
<input type="text" class="form-control" placeholder="input 3">
</div> <br/></td>
<td></td>
<td align="center"><input type="radio" name="a3"></td>
<td align="center"><input type="radio" name="a3"></td>
<td align="center"><input type="radio" name="a3"></td>
</tr>
<br><br>
<tr>
<td><div ng-controller="AlertDemoCtrl">
<input type="text" class="form-control" placeholder="input 3" ng-repeat="alert in alerts"
type="{{success.type}}" close="closeAlert($index)">{{success.msg}}<br></input>
<button type="button" class='btn btn-info' ng-click="addAlert()">+Add input</button>
<button type="reset" class="btn btn-danger">Reset</button>
</div> <br><br><br></td></tr>
and my angularJS part:
{{ ngapp }}.controller('AlertDemoCtrl', function ($scope) {
$scope.alerts = [
];
$scope.addAlert = function() {
$scope.alerts.push({msg: 'Another alert!'});
};
$scope.closeAlert = function(index) {
$scope.alerts.splice(index, 1);
};
});