我正在尝试提交表单。我正在使用ng-submit。在单击表格中的特定用户后,我使用firstName调用模式弹出窗口。 这是html的代码。
<form ng-submit="submitPunch()" class="form" ng-show="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-
hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Employee Punch In</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12 col-lg-12 form-group mgl15">
<label for="type">Employee</label><br>
<input type="hidden" ng-model="formData.employeeId">
{{firstName}} /* Here i want to show only firstName but i want to pass corresponding id of the employee with formData */
</div>
<div class="col-md-6 col-lg-6 form-group mgl15">
<label for="PIN">{{'label.Enter_Pin'|i18next}} <span
class="text-red">*</span></label>
<input class="form-control" id="pin" ng-model="formData.pin"
type="text" required>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" ng-
disabled="submitStatus==='success'">Submit</button>
</div>
</form>
以下是我将firstName传递给模态
的方法Controller.js
$scope.testpopup = function(employee){
$scope.firstName = employee.firstName;
$scope.employeeId=employee.id;
console.log($scope.employeeId);//Here i am getting id
$(".testmodal").modal("show");
}
现在我想发送员工ID和pin.But如果我用employeeData绑定employeeId它没有采取。我想传递id和pin用于保存。任何人都可以告诉如何将id与formData绑定?如果我把console($ scope.formData)它只显示输入的pin但不显示员工ID。
答案 0 :(得分:0)
Here's a fiddle that I've made.
$scope.testpopup = function(employee){
$(".modal").modal("show");
$scope.selectedEmployee = employee;
}
如果这与您的意图不符,请给我反馈。
但我建议您使用uib-modal.
<强>更新强>
这与你的目的更接近吗?