import { Injectable } from '@angular/core' ; import { ReplaySubject } from 'rxjs' ; import { Router } from '@angular/router' ; @ Injectable ( ) export class MenuService { private current : ReplaySubject < any > = new ReplaySubject < any > ( 1 ) ; constructor ( private router ) { } public setCurrent ( menu ) { this . current . next ( menu ) ; } public getCurrent ( ) { return this . current ; } }