import {Injectable} from '@angular/core'; import {BehaviorSubject, Subject} from 'rxjs'; @Injectable() export class StudentViewService { private onDashboardSource = new BehaviorSubject<Boolean>(true); public onDashboard$ = this.onDashboardSource.asObservable(); public changeToDashboard(flag: Boolean) { this.onDashboardSource.next(flag); } }