Skip to content

Instantly share code, notes, and snippets.

@dujo-stack
Created September 28, 2019 07:34
Show Gist options
  • Save dujo-stack/31a8188f249a8575ffbab19d35c79c58 to your computer and use it in GitHub Desktop.
Save dujo-stack/31a8188f249a8575ffbab19d35c79c58 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class DataService {
private messageSource = new BehaviorSubject('');
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