Angular 5 subscribe and unsubscribe Observable
问题 I have to get datas from two subscribe but I get always data of the first one. I have a data shared service : import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @Injectable() export class DataService { private source = new BehaviorSubject<any>(''); data = this.source.asObservable(); constructor() { } update(values: any) { this.source.next(values); } } Before leaving search component, I call update method. Now, I'm on the results component. I