1- import { Component , EventEmitter , Injector , Input , OnChanges , OnInit , Output , SimpleChanges } from '@angular/core' ;
1+ import {
2+ AfterViewInit ,
3+ Component ,
4+ EventEmitter ,
5+ Injector ,
6+ Input ,
7+ OnChanges ,
8+ OnInit ,
9+ Output ,
10+ SimpleChanges
11+ } from '@angular/core' ;
212import { Observable } from 'rxjs' ;
313import { Bookmark } from '../../core/model/bookmark' ;
414import { ActivatedRoute , Router } from '@angular/router' ;
@@ -15,7 +25,7 @@ import { TagFollowingBaseComponent } from '../tag-following-base-component/tag-f
1525 templateUrl : './async-bookmark-list.component.html' ,
1626 styleUrls : [ './async-bookmark-list.component.scss' ]
1727} )
18- export class AsyncBookmarkListComponent extends TagFollowingBaseComponent implements OnInit , OnChanges {
28+ export class AsyncBookmarkListComponent extends TagFollowingBaseComponent implements OnInit {
1929
2030 verifyForWatchedTag : Observable < string > ; // used to avoid looking in watchedTags for other tags in the html template
2131
@@ -40,14 +50,9 @@ export class AsyncBookmarkListComponent extends TagFollowingBaseComponent implem
4050 @Output ( )
4151 bookmarkDeleted = new EventEmitter < boolean > ( ) ;
4252
43- private router : Router ;
4453 readonly route : ActivatedRoute ;
45- private paginationNotificationService : PaginationNotificationService ;
46-
47- environment = environment ;
4854
4955 currentPage : number ;
50- paginationSize = environment . PAGINATION_PAGE_SIZE ;
5156
5257 Arr = Array ; // Array type captured in a variable
5358
@@ -61,40 +66,9 @@ export class AsyncBookmarkListComponent extends TagFollowingBaseComponent implem
6166 public loginDialog : MatDialog ,
6267 ) {
6368 super ( loginDialog , userDataWatchedTagsStore ) ;
64- this . router = < Router > this . injector . get ( Router ) ;
6569 this . route = < ActivatedRoute > this . injector . get ( ActivatedRoute ) ;
66- this . paginationNotificationService = < PaginationNotificationService > this . injector . get ( PaginationNotificationService ) ;
6770 }
6871
6972 ngOnInit ( ) : void {
7073 }
71-
72- ngOnChanges ( changes : SimpleChanges ) : void {
73- const page = this . route . snapshot . queryParamMap . get ( 'page' ) ;
74- if ( page ) {
75- this . currentPage = parseInt ( page , 0 ) ;
76- } else {
77- this . currentPage = 1 ;
78- }
79- }
80-
81- navigate ( page : number ) {
82- const paginationAction : PaginationAction = {
83- caller : this . callerPagination ,
84- page : page
85- }
86- this . currentPage = page ;
87- this . syncPageQueryParam ( ) ;
88- this . paginationNotificationService . clickPageNavigation ( paginationAction ) ;
89- }
90-
91- syncPageQueryParam ( ) {
92- this . router . navigate ( [ '.' ] ,
93- {
94- relativeTo : this . route ,
95- queryParams : { page : this . currentPage } ,
96- queryParamsHandling : 'merge'
97- }
98- ) ;
99- }
10074}
0 commit comments