【发布时间】:2014-10-13 20:50:32
【问题描述】:
功能:当我在form A 中添加资源时。资源显示在form B 中。然后我需要提交form B。
我无法提交。主要原因是:form B 中显示的所有字段都在循环中。所以我无法为每个字段提供具体名称。
HTML Codes of form B
<form id="attendanceSheet" name="attendanceSheet" ng-submit="fillupAttendanceSheet(attendanceSheet.$valid)" >
<table ng-table="tableParams" class="table">
<tr ng-repeat="resource in resources">
<td data-title="'Billable Resource'" style="text-align:center"><b>{{resource.resource_name}}</b></td>
<td data-title="'Working Hours'" style="text-align:center"><input type="number" style="width: 55px;" min="0" max="8" ng-model="timeSheetTest.hour" value="8" required></td>
<td data-title="'Working Hours'" style="text-align:center"><input type="number" style="width: 55px;" ng-model="timeSheetTest.nonhour" min="0" max="8" required></td>
</tr>
</table>
<div class="span2">
<button name="loginBtn" type="submit" class="btn" type="submit">Submit Sheet</button>
</div>
</form>
controller.js codes of form B
var addTimeSheet = function(timeSheetTest) {
console.log(timeSheetTest); // here I should get the form values
}
$scope.fillupAttendanceSheet = function(isFormValid) {
if(isFormValid){
addTimeSheet($scope.timeSheetTest);
}
【问题讨论】:
标签: html angularjs forms angularjs-ng-repeat