Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { BehaviorSubject } from 'rxjs/BehaviorSubject';
- import { distinctUntilChanged } from 'rxjs/operators/distinctUntilChanged';
- @Injectable()
- export class CourseDataService {
- private classIdSubject = new BehaviorSubject<string>(null);
- public classId = this.classIdSubject.asObservable().pipe(distinctUntilChanged());
- constructor() { }
- setClassId(classId: string) {
- this.classIdSubject.next(classId);
- }
- getClassId(): string {
- return this.classIdSubject.value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement