From a1b513f7668b982f518903b24d14c110140112b6 Mon Sep 17 00:00:00 2001 From: geek Date: Mon, 11 Jun 2018 22:02:27 +0900 Subject: [PATCH] ing --- .../target/component/list/list.component.html | 2 +- .../target/component/list/list.component.ts | 18 +++++++++--------- .../targets/target-list-page.component.ts | 10 +++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/@overflow/target/component/list/list.component.html b/@overflow/target/component/list/list.component.html index de9c49b..b2f0256 100644 --- a/@overflow/target/component/list/list.component.html +++ b/@overflow/target/component/list/list.component.html @@ -30,7 +30,7 @@ - diff --git a/@overflow/target/component/list/list.component.ts b/@overflow/target/component/list/list.component.ts index e4ea0a1..939d7b5 100644 --- a/@overflow/target/component/list/list.component.ts +++ b/@overflow/target/component/list/list.component.ts @@ -54,28 +54,28 @@ export class ListComponent implements OnInit, OnChanges { } ngOnInit() { - this.location.onPopState(() => { - // alert(window.location); - this.paginator.changePage(this.pageIdx); - }); this.getTargetList(); } ngOnChanges(changes: SimpleChanges): void { // console.log(changes); - if (changes['pageIdx'] && this.paginator) { + if (changes['pageIdx']) { // console.log(this.pageIdx); this.getTargetList(); - this.paginator.changePage(this.pageIdx); + // const p: number = this.pageIdx - 1; + // this.paginator.changePage(this.pageIdx); } } private getTargetList() { if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) { - this.pageIdx = 0; + this.pageIdx = 1; } + + const p: number = this.pageIdx - 1; + const pageParams: PageParams = { - pageNo: this.pageIdx, + pageNo: p, countPerPage: 2, sortCol: 'id', sortDirection: 'descending', @@ -111,6 +111,6 @@ export class ListComponent implements OnInit, OnChanges { onPaginate(e) { // e.changePage(); - this.pageChange.emit(e.page); + this.pageChange.emit(Number(e.page)); } } diff --git a/src/app/pages/targets/target-list-page.component.ts b/src/app/pages/targets/target-list-page.component.ts index 9f4541d..615b64e 100644 --- a/src/app/pages/targets/target-list-page.component.ts +++ b/src/app/pages/targets/target-list-page.component.ts @@ -22,14 +22,18 @@ export class TargetListPageComponent implements OnInit { this.pageIdx = Number(queryParams['page']); if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) { - this.pageIdx = 0; + this.pageIdx = 1; } }); } onPageChange(pageNo: number) { - this.pageIdx = pageNo; - this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: pageNo } }); + // console.log(pageNo); + // if (pageNo + 1 === this.pageIdx) { + // return; + // } + this.pageIdx = pageNo + 1; + this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: this.pageIdx } }); } onTargetSelect(target: Target) {