in my restangular project I am getting this error ,I tried few stuffs but didn't work , this is my ResponseInterceptor
restangularProvider.addResponseInterceptor(function (data, operation, what, url, response, deferred) {
if (operation == "getList") {
var responseData = response.data;
if (responseData.paginginfo == undefined) return responseData;
return { pagingInfo: responseData.paginginfo, data: responseData.result };
}
if (operation != "get") {
var item = { status: response.status };
feedBackFactory.showFeedBack(item);
}
return response.data;
});
}]);
I am using web api ,the code is given below
[Route("")]
[HttpGet]
public IHttpActionResult Get(int page, int size)
{
var paginginfo = new PagingModel { CurrentPage = page, RecordsPerPages = size };
var result = _userManagementService.Getusers(paginginfo);
if (result.Count == 0) return NotFound();
return Ok(new { result, paginginfo});
}
sample data from my api is
{"result":[{"id":"d615bf59-d089-e411-8295-a0481ca19571","firstname":"binson","lastname":"eldhose","username":"binson143","email":"binson143@gmail.com","mobile":"9846369298","userkey":"emp-009","notes":"binson","password":null,"image":"noimage.jpg","createdDate":"2014-12-22T14:47:48.407","status":"Active"},{"id":"0a79c171-c189-e411-8295-a0481ca19571","firstname":"jomon","lastname":"rv","username":"jomon@143","email":"jomon@gmail.com","mobile":"9876543478","userkey":"emp-007","notes":"good progtam","password":null,"image":"noimage.jpg","createdDate":"2014-12-22T13:01:06.817","status":"Active"},{"id":"f02053ff-b989-e411-8294-a0481ca19571","firstname":"Mohit","lastname":"Sarma","username":"mohit@gmail.com","email":"mohit@gmail.com","mobile":"9867564534","userkey":"Emp-008","notes":"A good programmer too","password":null,"image":"noimage.jpg","createdDate":"2014-12-22T12:07:48.35","status":"Active"},{"id":"e69a316c-bf89-e411-8295-a0481ca19571","firstname":"nizar","lastname":"kp","username":"nizar143","email":"nizar@gmail.com","mobile":"98675645321","userkey":"emp-009","notes":"good programmer","password":null,"image":"noimage.jpg","createdDate":"2014-12-22T12:46:38.023","status":"Active"},{"id":"5c2e3ede-b989-e411-8294-a0481ca19571","firstname":"Rins","lastname":"Dominc","username":"rins143","email":"rins@gmail.com","mobile":"98675654345","userkey":"Emp-001","notes":"Good employee","password":null,"image":"noimage.jpg","createdDate":"2014-12-22T12:06:52.85","status":"Active"}],"paginginfo":{"currentPage":1,"totalRecords":5,"recordsPerPages":10,"startRecord":1,"endRecord":5,"totalPages":1}}
what shoud I do to override this error, please not I cant change my api like
return Ok(new object[] { result, paginginfo});