From 2a2c19dfef7a9aa313c6ca0798f271c9a63449a9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Apr 2018 14:27:30 +0200 Subject: Replace current state when changing page --- client/src/app/shared/video/abstract-video-list.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 7f2cf2d7e..728c864e9 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -1,5 +1,6 @@ import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' +import { Location } from '@angular/common' import { isInMobileView } from '@app/shared/misc/utils' import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' import { NotificationsService } from 'angular2-notifications' @@ -40,6 +41,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { protected abstract authService: AuthService protected abstract router: Router protected abstract route: ActivatedRoute + protected abstract location: Location protected abstract currentRoute: string abstract titlePage: string @@ -164,8 +166,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { } protected setNewRouteParams () { - const routeParams = this.buildRouteParams() - this.router.navigate([ this.currentRoute ], { queryParams: routeParams }) + const paramsObject = this.buildRouteParams() + + const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') + this.location.replaceState(this.currentRoute, queryParams) } protected buildVideoPages () { -- cgit v1.2.3