Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/sharing.ts

Created Jun 11, 2020
Embed
What would you like to do?
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