Created
June 11, 2020 03:08
-
-
Save parzibyte/36a207a39e96cb313f24d00e7fa3868e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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