我已经做了一百万遍了,所以我有点困惑这里发生了什么。
我有一个名为PlacementForm的表单,其中包含许多字段,但是每当我键入除候选人名称以外的任何字段时,该字段将变为未定义,但如果我删除该文本,则它将返回到“”。
我有一个使用这些字段的表单(还有控制器)
var application = angular.module('timeSheetsApplication',[]);
application.controller("portalController",
function($scope) {
$scope.placementForm = {};
$scope.placementForm.candidateName = "";
$scope.placementForm.clientName = "";
$scope.placementForm.jobTitle = "";
$scope.placementForm.placementStartDate = "";
$scope.placementForm.placementEndDate = "";
$scope.placementForm.frequency = "";
});
,其形式为:
<div class="md-form">
<i class="fa fa-envelope prefix red-text"></i>
<input type="email" id="clientName" class="form-control" ng-model="placementForm.clientName" placeholder="Client Name">
</div>
<div class="md-form">
<i class="fa fa-envelope prefix red-text"></i>
<input type="email" id="txtJobTitle" class="form-control" ng-model="placementForm.jobTitle"placeholder="Job Title">
</div>
<div class="md-form">
<i class="fa fa-envelope prefix red-text"></i>
<input type="email" id="placementStartDate" class="form-control datepicker" ng-model="placementForm.placementStartDate" placeholder="Placement Start Date">
</div>
<div class="md-form">
<i class="fa fa-envelope prefix red-text"></i>
<input type="email" id="placementEndDate" class="form-control datepicker" ng-model="placementForm.placementEndDate" placeholder="Placement End Date">
</div>
<select class="mdb-select" ng-model="placementForm.frequency">
<option value="" disabled selected>Choose your option</option>
<option value="WEEK">Weekly</option>
<option value="MONTH">Monthly</option>
</select>