-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Description
Bug, feature request, or proposal:
Bug: numberOfPages is off by one.
Right now numberOfPages() is calculated as
Math.ceil(this.length / this.pageSize) - 1;Which would work nicely for zero-based calculations, but doesn't work so well for actual display or the mental model of what "number of pages" represent.
For example:
length=1,pageSize=5=>numberOfPages()returns0(there should be 1 page right?)
Consider the example of splitting an array into page chunks (i.e. any[] => any[][]), the resulting array be size of 1.
What is the expected behavior?
Should return the current page count.
What is the current behavior?
As described above.
What is the use-case or motivation for changing an existing behavior?
See above.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
since v5.2.0, also in the v6.0.0-rc.0
Is there anything else we should know?
There doesn't seem to be any tests for numberOfPages, a public method.
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent