Currently, when you make a REST call to get items from the server, there is a maximum number of results you can get back in a single ajax call, the response you get back actually contains pagination details to fetch either the next or the previous batch in case there are more items. Our angular resources should be smart enough to utilize the next link and be able to make more calls until all the results are returned. Therefore, want to provide a mechanism where all the items get returned within a single call made to an angular resource.
- Add a utility function to the uicommons module probably in the angular-common.js file that can fetch all results given an angular resource and optional request parameters, in theory this function should inspect the returned results to get the next link and fetch the next page of results until there are no more results i.e the next link doesn't exist in the returned json. Note that the next link might not be valid if the admin has not yet set the global property value for url prefix for the rest module, if this is the cause you need to default to the current one they have being used in the browser.
- Update all existing 'get all' functions in the angular apps in the module to delegate to the new function e.g getEncounterTypes in encounterTypeService.js file