control back button

This commit is contained in:
_Bastler
2021-09-08 11:09:26 +02:00
parent 258f253a14
commit 885c95e63b
3 changed files with 49 additions and 49 deletions
@@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {Location} from '@angular/common'
import {Router, ActivatedRoute} from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common'
import { Router, ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-unavailable',
@@ -13,23 +13,23 @@ export class UnavailableComponent implements OnInit {
constructor(
private location: Location,
private router: Router,
private route: ActivatedRoute) {}
private route: ActivatedRoute) { }
ngOnInit(): void {
this.route.queryParams.subscribe(params => {
if(params['target']) {
this.targetRoute = params['target'];
this.router.navigate([], {queryParams: {target: null}, queryParamsHandling: 'merge'});
if (params[ 'target' ]) {
this.targetRoute = params[ 'target' ];
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', skipLocationChange: true });
}
});
}
retry() {
if(!this.targetRoute || this.targetRoute === "unavailable" || this.targetRoute === "/unavailable") {
if (!this.targetRoute || this.targetRoute === "unavailable" || this.targetRoute === "/unavailable") {
this.location.back;
} else {
this.router.navigate([this.targetRoute]);
this.router.navigate([ this.targetRoute ], { skipLocationChange: true });
}
}