Loading issue in webapi and angularjs

Posted by Klbaiju under ASP.NET Web API on 7/31/2018 | Points: 10 | Views : 65 | Status : [Member] | Replies : 0
Hi,

When I try to display records in table using webapi and angularjs , page loading is slow in first time

my code foe webapi

private ExerciseEntities1 db = new ExerciseEntities1();

// GET api/Employee
public IQueryable<Employee> GetEmployees()
{
return db.Employees;
}

index page

<style type="text/css">
table, tr, td, th {
border: 1px solid grey;
border-collapse: collapse;
}
</style>

<script src="~/Scripts/angular.min.js"></script>
<script>
var App = angular.module("myApp", [])
App.controller("myCtrl", function ($scope, $http) {
GetAll();
function GetAll() {

$http.get('/api/employee/').then(function (response) {
$scope.Employee = response.data
}, function () {
alert("failure");
}
);
}


});


</script>
<div ng-app="myApp" ng-controller="myCtrl">
<table>
<tr><td>Id</td><td>FirstName</td><td>LastName</td><td>Company</td></tr>
<tr ng-repeat="item in Employee">


<td>{{item.Id}}</td>
<td>{{item.FirstName}}</td>
<td>{{item.LastName}}</td>
<td>{{item.Company}}</td>

</tr>



</table>



</div>

code has no error.problem getting slow on loading first time


how to solve this


Regards

Baiju




Responses

(No response found.)

Login to post response