Skip to content

Instantly share code, notes, and snippets.

@ngohungphuc
Created August 2, 2019 08:41
Show Gist options
  • Select an option

  • Save ngohungphuc/0b05de80ff36e30bb8f9712b58c20e9f to your computer and use it in GitHub Desktop.

Select an option

Save ngohungphuc/0b05de80ff36e30bb8f9712b58c20e9f to your computer and use it in GitHub Desktop.
import { Injectable } from "@angular/core";
import { Subject } from "rxjs";
@Injectable()
export class MessageService {
private subject = new Subject<any>();
constructor() {}
sendMessage(message: any) {
this.subject.next(message);
}
getData() {
return this.subject.asObservable();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment