Advertisement
Guest User

Untitled

a guest
May 16th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable } from '@angular/core';
  2. import { BehaviorSubject } from 'rxjs/BehaviorSubject';
  3. import { distinctUntilChanged } from 'rxjs/operators/distinctUntilChanged';
  4.  
  5. @Injectable()
  6. export class CourseDataService {
  7.  
  8.   private classIdSubject = new BehaviorSubject<string>(null);
  9.   public classId = this.classIdSubject.asObservable().pipe(distinctUntilChanged());
  10.  
  11.  
  12.   constructor() { }
  13.  
  14.   setClassId(classId: string) {
  15.     this.classIdSubject.next(classId);
  16.   }
  17.  
  18.   getClassId(): string {
  19.     return this.classIdSubject.value;
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement