I'm struggling to figure out how to handle table data with multiple rows. I'm working on registering an employer in the system, where they need to input qualification details through a modal. These details are then saved in an HTML table for viewing. Eventually, all the information entered, including what's in the table, needs to be passed through an Angular controller via a service to the database. Here is my `controller.js`:
This function sends the data:
$scope.register = function (isValid) {
console.log($scope.records);
if (isValid) {
var regidetail = {
fname: $scope.registDetails.fname,
lname: $scope.registDetails.lname,
// More fields here...
};
console.log(regidetail);
UserService.Register(regidetail, function (res) {
EMPID = (res.data);
console.log(res.data);
});
}
}
Here is the corresponding HTML:
<div class="form-group">
<label class="col-lg-2 col-md-3 control-label" for="">Qualifications</label>
<div class="col-lg-10 col-md-9 ">
<table id="basic-datatables" name="datatables" class="table table-striped table-bordered table-hover" cellspacing="0" width="100">
<thead>
<tr>
<th>Qualification Type</th>
<!-- More table headers... -->
</tr>
</thead>
<tbody>
<tr ng-repeat="(recordIndex, record) in records" style="text-align:center">
<td ng-model="registDetails.qualification_type">{{record.qualification_type}}</td>
<!-- More table body elements... -->
</tr>
</tbody>
</table>
</div>
<!-- Modal... -->
</div>
If anyone can provide any assistance, it would be greatly appreciated! :)