Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { Observable } from 'rxjs/Observable';
- import { AsyncSubject } from 'rxjs/AsyncSubject';
- export interface DataValue {
- items: string[];
- }
- @Injectable()
- export class SharedData {
- private readonly valueSubject: AsyncSubject<DataValue> =
- new AsyncSubject<DataValue>();
- init(value: DataValue) {
- this.valueSubject.next(value);
- this.valueSubject.complete();
- }
- get value(): Observable<DataValue> {
- return this.valueSubject.asObservable();
- }
- }
Add Comment
Please, Sign In to add comment