import {Injectable} from '@angular/core'; | |
import {BehaviorSubject} from "rxjs"; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class DataSharingService { | |
private messageSource = new BehaviorSubject('default message'); | |
currentMessage = this.messageSource.asObservable(); | |
constructor() { | |
} | |
changeMessage(message: string) { | |
this.messageSource.next(message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment