I have implemented Odata query syntax for my web api. I am successfully able to return only the first 10 results and the link for the further results. However I am unable to extract this link from the JSON object that is returned by the server using my angularjs front end.
Say the server is responding as follows:
{
"odata.metadata":"http://localhost:60497/odata/$metadata#tables","value":[
{
"id":001,"name":"abc"
},{
"id":002,"name":"pqr"
},{
"id":003,"name":"xyz"
},{
.
.
.
],"odata.nextLink":"http://localhost:60497/odata/tables?$skip=10"
}
Now I am displaying the data by using the success method of $http by assigning the returned data to a variable and using ng-repeat. I am assigning it as follows:
.success(function(data)){
$scope.foo = data.value;
}
However when I try to access the next link using:
$scope.link = data.odata.nextLink;
within the success method it gives me an error. What am I missing over here? How else can I access the link returned? Is there any other method to implement server side paging?