ELR RLE

ELR RLE

  • NA
  • 156
  • 7.4k

Why data showing time is long using AngularJS?

Nov 4 2016 12:47 AM
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
<tr ng-repeat="n in user" ng-click="GetDataybyID(n.ID,n.Name,n.Description,n.Remark)">
<td>{{n.Name}}</td>
<td>{{n.Description}}</td></tr>
 
 
<tr ng-repeat="user in userList">
<td>{{user.Employee_No}}</td>
<td>{{user.Employee_Name}}</td>
<td>{{user.Position_Name}}</td>
<td>{{user.Department_Name}}</td>
</tr> 
 
 
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!";
});
}; 
 
 
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);
 
 

Answers (2)