-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(NgTableController): optimize calls to reload
Coalesce updates to parameters and a call to reload into a single call to `getData` **WARNING**: the *"private"* `$params` field has been removed from `NgTableParams` This means the following code pattern can be avoided: ```js /* reset table ... */ if (params.hasFilter() || params.page() > 1) { // this will trigger a reload later in the $digest cycle params.filter({}); params.page(1); // return a dummy promise to satisfy the api of our function // note: we don't want to call reload as this would result in two calls to getData return $q.when(null); } else { // just reload current page return params.reload(); } ``` Instead the above can be simplified and still yield a single call to `getData` ```js /* reset table ... */ params.filter({}); params.page(1); return params.reload({ filter: {}, page: 1}); ```
- Loading branch information
1 parent
95b0f2b
commit e94ca5f
Showing
3 changed files
with
20 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters