import { Component, OnInit } from '@angular/core'; import { SharedServiceService } from '../../services/shared-service.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-modal-two', templateUrl: './modal-two.component.html', styleUrls: ['./modal-two.component.css'] }) export class ModalTwoComponent implements OnInit { title: string; constructor(private shared: SharedServiceService, private router: Router) { shared.title$.subscribe(title => { this.title = title; }); } ngOnInit() { } btnChange() { this.shared.changedTitle('modal-two'); } btnPrev() { this.router.navigate(['/wizard', 1]); } btnClose() { this.router.navigateByUrl('/dummy').then(() => { this.router.navigateByUrl('/wizard'); }); // this.shared.changedTitle('wizard'); } }