Populate (Bind) DropDownList using Entity Framework in AngularJS

Last Reply 2 months ago By SUJAYS

Posted 2 months ago

How to populate the dropdownlist using entity framework in angular js?

You are viewing reply posted by: SUJAYS 2 months ago.
Posted 2 months ago

 Bind Dropdownlist using angularjs 

public JsonResult GetAllLatereason()
{
    using (Latereason_INGEntities Obj = new Latereason_INGEntities())
    { 
        List<LateReason> Late = Obj.LateReasons.ToList();
        return Json(Late, JsonRequestBehavior.AllowGet);
    }
}

 

$scope.GetAllLatereason = function () {
    $http({
       method: "get",
       url: "http://localhost:62537/Package/GetAllLatereason"})
       .then(function (response) {
           $scope.Late_INGEntities = response.data;
       }, function () {
           alert("Error Occur");
    })
};
<div class="col-sm-4 p-0">
    <select ng-model="Locations" ng-options="location.Code as location.LocationDescription for location in Location_INGEntities" ng-init="GetAllLocation()" class="w-100 form-control"></select>
</div>