import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs'; import { Location } from '@angular/common'; @Component({ selector: 'app-details', templateUrl: './details.component.html', styleUrls: ['./details.component.scss'] }) export class DetailsComponent implements OnInit { selectedSegment: string = 'forum'; heading: string; routeSubscription: Subscription; selectedChapter: number = 1; showMorePostOptions: boolean = false; selectedPost: number; constructor( private route: ActivatedRoute, private location: Location ) { } ngOnInit(): void { this.routeSubscription = this.route.params.subscribe((params) => { this.heading = params['heading']; }); } ngOnDestroy() { this.routeSubscription.unsubscribe(); } back() { this.location.back(); } }