Why data showing time is long by AngularJS in MVC 4 using Razor Syntax?
In my code, loading time is long in showing data in the userList when ng-click.
Please answer me.
View in MVC
eg
Method Calling using AngularJS
$scope.GetDataybyID = function (ID, Name, Description, Remark) {
$http.get('GetData', { params: { userId: ID } }).success(function (data) {
$scope.userList= data;
if (data.length == 0) {
}
else {
}
}).error(function () {
$scope.error = "An Error has occured while loading posts!";
});
};
$http.get('GetData', { params: { userId: ID } }).success(function (data) {
$scope.userList= data;
if (data.length == 0) {
}
else {
}
}).error(function () {
$scope.error = "An Error has occured while loading posts!";
});
};
Method in C#
public JsonResult GetData(int userId)
{
var empListbyID=(from e in db.tbl_Employee.AsEnumerable()
select new { e.Employee_No, e.Employee_Name, p.Position_Name, d.Department_Name}).ToList();
return Json(empListbyID, JsonRequestBehavior.AllowGet);
}
{
var empListbyID=(from e in db.tbl_Employee.AsEnumerable()
select new { e.Employee_No, e.Employee_Name, p.Position_Name, d.Department_Name}).ToList();
return Json(empListbyID, JsonRequestBehavior.AllowGet);
}
ELR RLEPosted Nov 5, 2016, 12:01 AM
Bikesh SrivastavaPosted Nov 4, 2016, 2:38 PM