You can also have the pageIndex
as a URL param of the page where list-component
is rendered.
Inject in your ctor:
private route: ActivatedRoute
Then in your ngOnInit
do something like:
this.route.params.subscribe((params: any) => {
if (params.pageIndex) {
this.pageIndex = params.pageIndex;
}
});
In your routing module your URL should match: some-url/:pageIndex
. And when paging back and forth in the list the URL should be updated accordingly.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…