angularjs - How to retrieve all instances on the JHipster API for entities -
when calling generated api when using paginator, there way can call generated rest-api retrieve instances of object, insted of first 20,30,40 etc?
i find since using pagination entity-creation , management, when want utilize these entities in other views (self created), api not provide instances when calling entity.query()
in angular/js.
is limitation jhipster, or can call rest-api in other way supplying info discard paginator?
you can modify existing rest controller entity. here example center
entity.
i return centers if there no value offset , limit.
@requestmapping(value = "/centers", method = requestmethod.get, produces = mediatype.application_json_value) @timed public responseentity<list<center>> getall(@requestparam(value = "page" , required = false) integer offset, @requestparam(value = "per_page", required = false) integer limit) throws urisyntaxexception { if(offset == null && limit == null) { return new responseentity<list<center>>(centerrepository.findall(), httpstatus.ok); } else { page<center> page = centerrepository.findall(paginationutil.generatepagerequest(offset, limit)); httpheaders headers = paginationutil.generatepaginationhttpheaders(page, "/api/centers", offset, limit); return new responseentity<list<center>>(page.getcontent(), headers, httpstatus.ok); } }
then in angular, have call center.query();
without params.
Comments
Post a Comment