@RestController
@Transactional
public class ApiController {
@Autowired
CategoryService categoryService;
@SuppressWarnings("deprecation")
@RequestMapping(value="/api/category/page", method=RequestMethod.GET)
public Page<Category> getCategoryList() {
return categoryService.findAll(new PageRequest(0, 10));
}
}
I would like to retrieve the Page for use in the angularjs, which returns nothing: {}
. While I getContent ()
the data is still available on request:
[{"cid": 1, "cname": "Tien Hiep", "cmetaTitle": "tien-hiep",
"createDate": "May 6, 2018 1:04:58 PM "," createBy ":" Admin ","
modifiedDate ":" May 28, 2018 11:09:57 AM "," modifiedBy ":" Admin
"," cstatus " ..]
If I want to return the page type like:
{
"content":[
{"cid": 1, "cname": "Tien Hiep", "cmetaTitle": "tien-hiep", "createDate": "May 6, 018 1:04:58 PM "," createBy ":" Admin "," modifiedDate ":" May 28, 2018 11:09:57 AM "," modifiedBy ":" Admin "," cstatus "},
...
],
"last":false,
"totalElements":10,
"totalPages":4,
"size":10,
"number":0,
"sort":null,
"first":true,
}
Can anybody help me fix that?