2016-07-31 3 views
0

に結合しない:なぜドロップダウンリストの値は、私は、データがドロップダウンリストに結合されているが、私は、データベースに値をロードしようとするが、そのデータがbinfingないここ角度JS MVCを使用しているデータベース

<div class="form-group"> 
         <div class="row"> 
          <div class="col-md-2 col-sm-2" style="margin-left:20px"> 
           <b>State</b> 
          </div> 
          <div class="col-md-8 col-sm-8"> 
            <select class="form-control" data-modal="modal" ng-options="I.CountryID as I.CountryName for I in CountryList" ng-model="CountryID" ng-change="StateList()" ng-required="true"> 
           <option value="" disabled selected>--Select Country--</option> 
          </div> 
         </div> 
        </div> 

角度コード

$scope.AddUpdateEmployee = function (Emp) { 
     alert("Enter in update") 
     var Employee = { 
      Id: $scope.EmployeeId, 
      Name: $scope.EmployeeName, 
      Email: $scope.EmployeeEmail, 
      Psw: $scope.Password, 
      Country: $scope.CountryID, 

     }; 

MVCコード

public JsonResult AddEmployee(Employee emps) 
     { 
      if (emps != null) 
      { 
       Employee ee = new Employee(); 
       ee.Name = emps.Name; 
       ee.Email = emps.Email; 
       ee.Psw = emps.Psw; 
       ee.Country = emps.Country; 
       ee.State = emps.State; 
       ee.City = emps.City; 
      } 
+0

あなたがにデータを投稿しようとするのですかデータベース?私は全体のコードを見ることができます、今すぐあなたは作品を共有している、私はあなたがどこにバインドされているhtmlを参照する必要がありますか? –

答えて

0

データベースからのバインディングを確認してください。

http://jsfiddle.net/81t6cbjw/261/

<select class="form-control" data-modal="modal" 
      ng-options="I.CountryID as I.CountryName for I in CountryList" 
      ng-model="CountryID" ng-change="StateList()" ng-required="true"> 
     <option value="" disabled selected>--Select Country--</option> 
    </select> 
0

データが来ている前に、select要素でng-ifを追加し、問題の要素は、レンダリング、それに時計をセットしng-if

<select ng-if="CountryList && CountryList.length" class="form-control" data-modal="modal" ng-options="I.CountryID as I.CountryName for I in CountryList" ng-model="CountryID" ng-change="StateList()" ng-required="true"> 
     <option value="" disabled selected>--Select Country--</option> 
</select> 
関連する問題

 関連する問題