Loading issue in webapi and angularjs

Posted by Klbaiju under ASP.NET Web API on 7/31/2018 | Points: 10 | Views : 2268 | Status : [Member] | Replies : 2
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

Posted by: Raghu320 on: 8/31/2018 [Member] Starter | Points: 25
Posted by: Raghu320 on: 8/31/2018 [Member] Starter | Points: 25

Up
0
Down
https://freejulycalendar2018.com/september-2018-calendar-printable/
http://www.horsecampsontario.com/2017/08/september-2017-calendar.html

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response