diff options
author | benal01 <bja4245@rit.edu> | 2025-04-02 10:27:48 -0400 |
---|---|---|
committer | benal01 <bja4245@rit.edu> | 2025-04-02 10:27:48 -0400 |
commit | 91e8835b84b00bffc6db350f7cf6641c0d128a93 (patch) | |
tree | 7d2171ba311357d1a0f4ec9ab84c277ee2d2f128 /ufund-ui/src/app/components/need-list/need-list.component.ts | |
parent | 41a18efce59852ccff91816bbe63f5001346f2ed (diff) | |
download | JellySolutions-91e8835b84b00bffc6db350f7cf6641c0d128a93.tar.gz JellySolutions-91e8835b84b00bffc6db350f7cf6641c0d128a93.tar.bz2 JellySolutions-91e8835b84b00bffc6db350f7cf6641c0d128a93.zip |
negative and large input handling for need page amount
Diffstat (limited to 'ufund-ui/src/app/components/need-list/need-list.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index cd3d9bd..ed14d6a 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -82,9 +82,14 @@ export class NeedListComponent { this.updateVisibleNeeds(); } - editNeedsPerPage(amount: number) { - this.itemsPerPage = amount; - this.updateVisibleNeeds(); + editNeedsPerPage() { + if (this.itemsPerPage > this.searchResults.length) { + this.itemsPerPage = this.searchResults.length; + } + if (this.itemsPerPage < 1) { + this.itemsPerPage = 1; + } + this.resetVisibleNeeds(); } updateVisibleNeeds() { |