0
下面是我的代碼,我有3個輸入和一個視圖按鈕,點擊查看時,我將從服務器獲取數據。 3個輸入是客戶,日期,班次,我將這3個輸入保存在一個ng-repeat中,以重複我擁有的客戶數量。如果的customerID = 1,則NG-模式自定義輸入也爲1吳重複ng重複問題
<div ng-repeat = "x in CustomerList">
<form class="form-horizontal" ng-submit="getproductiondetails()">
<div class="form-group">
<div class="row">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-users"></i></span>
<select required class="form-control" ng-value= "x.customerID" ng-model="data.CustomerID">
</select>
</div>
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
<input type="text" class="form-control" uib-datepicker-popup="dd-MMM-yyyy" ng-model="data.ProductionReportDate" is-open="popup1.opened" required close-text="Close" />
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-mars"></i></span>
<select required class="form-control" ng-model="data.ShiftTypeID">
<option value="">Shift</option>
<option ng-repeat="y in shiftList" value="{{y.ShiftTypeID}}">{{y.ShiftTypeName}}</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-2 pull-left">
<button type="submit" class="btn btn-primary">View</button>
</div>
</div>
</div>
</form>
</div>
但這裏NG-模型在客戶輸入它沒有選擇時的customerID值。 如何讓客戶輸入從ng-repeat中選擇customerID值?
在CustomerList示例數據:
- 客戶id = 1,客戶名稱= KL
- 客戶id = 2,客戶名稱= JK在ShiftList
示例數據:
- ShiftID = 1,ShiftName =第一偏移
- ShiftID = 2,ShiftName = 2nd Shift
對不起它的角度 – Ranger
也許它應該是'ng-model =「x.ShiftTypeID」'而不是'ng-model =「data.ShiftTypeID」'?並且你應該避免使用相同的中繼器別名(在選項中爲'ng-repeat =「x in shiftList」',CustomerList中爲'ng-repeat =「x)( –
對於初學者,ng-repeat =」CustomerList「 '和'ng-repeat =「x in shiftList」'共享它可能不喜歡的變量'x' –