我试图从文本框中获取值,但是日志中缺少字段城市的值,而其他一些字段则混乱不堪。我检查了html表单,没关系。我错过了什么吗?
这里是html表单代码:
<form="myForm">
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="MMID" ng-model="mmid" class="form-control" maxlength="9" />
</div>
<div class="col-xs-6">
<input type="text" placeholder="Card Number" ng-model="cardNumber" class="form-control" maxlength="11" />
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="First Name" ng-model="fname" class="form-control" maxlength="25">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Gender (M or F)" ng-model="gender" class="form-control" maxlength="1">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Middle Name" ng-model="mname" class="form-control" maxlength="25">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Birthplace" ng-model="birthplace" class="form-control" maxlength="30">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Last Name" ng-model="lname" class="form-control" maxlength="25">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Citizenship" ng-model="citizenship" class="form-control" maxlength="30">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Birthdate (MM/DD/YYYY)" ng-model="bday" class="form-control" maxlength="8">
</div>
<div class="col-xs-6">
<input type="text" placeholder="SSS ID / TIN ID" ng-model="sssTinID" class="form-control" maxlength="20">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="email" placeholder="Email Address" ng-model="email" class="form-control" maxlength="30">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Company Name" ng-model="companyName" class="form-control" maxlength="30">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Mobile Number" ng-model="mobile" class="form-control" maxlength="15">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Company Address" ng-model="companyAddress" class="form-control" maxlength="30">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Address" ng-model="address" class="form-control" maxlength="60">
</div>
<div class="col-xs-6">
<input type="text" placeholder="Work Title" ng-model="workTitle" class="form-control" maxlength="30">
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="City" ng-model="city" class="form-control" maxlength="30">
</div>
<div class="col-xs-6">
<label for="sourceOfFunds">Source of Funds: </label>
<select id="sourceOfFunds" ng-model="srcFunds" ng-change="showSelectValue(srcFunds)">
<option>Employment</option>
<option>Business</option>
<option>Other</option>
</select>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input type="text" placeholder="Zip Code" ng-model="zipcode" class="form-control" maxlength="10">
</div>
<div class="col-xs-6">
<input type="text" placeholder="*If others, specify source of funds" ng-model="otherSrcFunds" class="form-control" maxlength="30">
</div>
</div>
这里是controller.js的代码:
$scope.goNextandSave = function(mmid,cardNumber,fname,mname,lname,bday,email,mobile,address,city,zipcode,gender,birthplace,citizenship, sssTinID,companyName,companyAddress,workTitle, srcFunds, otherSrcFunds)
{
console.log("srcFunds = " + srcFunds);
console.log("fnamane = " + fname);
console.log("mname = " + mname);
console.log("lname = " + lname);
console.log("bday = " + bday);
console.log("email = " + email);
console.log("mobile = " + mobile);
console.log("address = " + address);
console.log("city = " + city);
console.log("zipcode = " + zipcode);
console.log("gender = " + gender);
console.log("birthplace = " + birthplace);
console.log("citizenship = " + citizenship );
console.log("sss = " + sssTinID);
console.log("companyName = " + companyName);
console.log("companyAddress = " + companyAddress);
console.log("workTitle = " + workTitle);
}
并且这里是console.logs中的输出:
srcFunds = Business
controllers.js:131 fnamane = fname
controllers.js:132 mname = mname
controllers.js:133 lname = lname
controllers.js:135 bday = bdate
controllers.js:136 email = email@email.com
controllers.js:137 mobile = mobile
controllers.js:139 address = address
controllers.js:140 city = zip
controllers.js:141 zipcode = g
controllers.js:143 gender = bplace
controllers.js:144 birthplace = citizenship
controllers.js:145 citizenship = sss
controllers.js:147 sss = companyName
controllers.js:148 companyName = companyAddress
controllers.js:149 companyAddress = worktitle
controllers.js:151 workTitle = Business