src/app/errors/error404/error404.component.ts
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { take } from 'rxjs/operators';
@Component({
selector: 'app-error404',
templateUrl: './error404.component.html',
styleUrls: ['./error404.component.less']
})
export class Error404Component implements OnInit {
path: string;
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.data.pipe(take(1))
.subscribe((data: { path: string }) => {
this.path = data.path;
});
}
}