aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-list/need-list.component.ts
diff options
context:
space:
mode:
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.ts50
1 files changed, 26 insertions, 24 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 40af9f5..564f1f0 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
@@ -14,13 +14,9 @@ export class NeedListComponent implements OnChanges {
@Input() actionArea: TemplateRef<any> | null = null
visibleNeeds: Need[] = [];
- currentPage: number = 0;
+ currentPage: number = localStorage.getItem('currentPage') ? parseInt(localStorage.getItem('currentPage')!) : 0;
totalPages: number = 0;
- constructor(
-
- ) {}
-
ngOnChanges() {
this.updateVisibleNeeds()
}
@@ -29,25 +25,31 @@ export class NeedListComponent implements OnChanges {
return (need.type === GoalType.MONETARY) ? "$" : "";
}
- decrementPage() {
- this.currentPage--;
- this.updateVisibleNeeds();
- }
-
- incrementPage() {
- this.currentPage++;
- this.updateVisibleNeeds();
- }
-
- lastPage() {
- this.currentPage = this.totalPages - 1
- this.updateVisibleNeeds()
- }
-
- firstPage() {
- this.currentPage = 0
- this.updateVisibleNeeds()
- }
+ //increment/decrement
+ decrementPage() {
+ this.currentPage--;
+ localStorage.setItem('currentPage', this.currentPage.toString());
+ this.updateVisibleNeeds();
+ }
+
+ incrementPage() {
+ this.currentPage++;
+ localStorage.setItem('currentPage', this.currentPage.toString());
+ this.updateVisibleNeeds();
+ }
+
+ //skipping pages
+ lastPage() {
+ this.currentPage = this.totalPages - 1
+ localStorage.setItem('currentPage', this.currentPage.toString());
+ this.updateVisibleNeeds()
+ }
+
+ firstPage() {
+ this.currentPage = 0
+ localStorage.setItem('currentPage', this.currentPage.toString());
+ this.updateVisibleNeeds()
+ }
updateVisibleNeeds() {
this.totalPages = Math.ceil(this.needs.length / this.itemsPerPage);