2017-02-14 5 views
0

以下は私のコードです.3つの入力とビューボタンがあり、ここでビューをクリックするとサーバーからデータが取得されます。 3つの入力はCustomer、Date、Shiftです。私は、この3つの入力をng-repeatで保持しています。得意先= 1は、顧客入力用NG-モデルはNG-モデルのためにも1ng-repeat問題のng-modal

<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-repeatからcustomerIDの値を選択するための入力方法CUSTOMERLISTで

サンプルデータ:

  1. 得意= 1、のCustomerName = KL
  2. 得意= 2、

サンプルデータShiftListでのCustomerName = JK:

  1. ShiftID = 1、ShiftName = 1stシフト
  2. ShiftID = 2、ShiftName = 2ndシフト
+0

申し訳ありませんが、角度が – Ranger

+0

「ng-model =」data.ShiftTypeID「 ''の代わりに 'ng-model =" x.ShiftTypeID "'にする必要がありますか?そして、同じリピーターエイリアス名( 'ng-repeat =" xはオプションで、 'ng-repeat =" xはCustomerList "( –

+0

) 'と' ng-repeat = "x of shiftList"は、おそらく好きではない変数 'x'を共有します –

答えて

0

フォームで繰り返してください。代わりに値を繰り返して表示することはできませんか? すべての行に編集ボタンがあります。そのボタンを押すと編集モードに入ることができます。私はビューモードと編集モードを分割するのが好きです。注:ある行を編集する場合は、 'SINGLE'行オブジェクトのサーバーPUT/PATCHリソースが必要になります。簡単な例が必要な場合はお答えください

関連する問題