Reputation: 279
I am trying to get data's leave details from server. When I click or reload the link (http://localhost/portal/getleaves) api request send two times in firebug.
Sample code attached here:
$http.get('/portal/api/leave/'+id).
success(function(data) {
var data = data.result;
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 10, // count per page
sorting: {
name: 'asc' // initial sorting
}
}, {
total: data.length, // length of data
getData: function($defer, params) {
$defer.resolve(data);
}
});
});
Thanks.
Upvotes: 0
Views: 876
Reputation: 31761
It's probably one of the following:
1) Your entire controller is being executed twice.
2) You aren't actually sending out 2 GET requests. If you are doing CORS requests an OPTIONS request will be sent before the GET request is sent.
Upvotes: 1