2016-07-31 2 views
0
내가 각도 JS MVC 여기에 데이터를 드롭 다운리스트에 구속력을 사용하고

에 바인딩하지하지만 데이터베이스에 값을로드하려고하지만 때 데이터 binfing하지 :왜 드롭 다운리스트 값은 데이터베이스

<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

선택 요소에 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>