Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. export class DataService{
  2. private dataSource = new Subject();
  3. currentData = this.dataSource.asObservable();
  4.  
  5. constructor(private http: HttpClient) {
  6. this.http.get('/api/v1/data').subscribe(data => {
  7. this.updateData(data);
  8. });
  9. }
  10.  
  11. updateData(data) {
  12. this.dataSource.next(data);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement