You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RTL/src/app/shared/components/error/error.component.ts

26 lines
712 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import { Subject } from 'rxjs';
import { filter, map, takeUntil } from 'rxjs/operators';
@Component({
selector: 'rtl-error',
templateUrl: './error.component.html'
})
export class ErrorComponent implements OnInit {
error = {errorCode: '', errorMessage: ''};
private unsubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private router: Router, private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.activatedRoute.paramMap
.pipe(takeUntil(this.unsubs[0]))
.subscribe(data => {
this.error = window.history.state;
});
}
}