From 91e8835b84b00bffc6db350f7cf6641c0d128a93 Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 2 Apr 2025 10:27:48 -0400 Subject: negative and large input handling for need page amount --- ufund-ui/src/app/components/need-list/need-list.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ufund-ui/src/app/components/need-list/need-list.component.ts') 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() { -- cgit v1.2.3