i cannot update the data import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class DataService { private data1 = new BehaviorSubject<any>(null); data = this.data1.asObservable(); data3:any; constructor() { } sendData(data: any) { this.data1.next(data); } getData(): Observable<any> { return this.data; } } app.component.ts file: public postData(name: string) { const headers = { "Content-Type": "multipart/form-data" }; this.http.post("http://localhost:5000/app/", name, { headers: headers }) .subscribe( (response) => { console.log(response); this.data = response; }, (error) => { console.error(error); }); } parcourir.component.ts file: export class ParcourirComponent implements OnInit{ data1:any; constructor(private serviceataService){} ngOnInit() { this.service.getData().subscribe(response=>{ this.data1 = response; console.log(this.data1) }); } It logs null to the console, it's not updating data i want the response get in the http request in app.component.ts to be sent to parcourir.component.ts. Continue reading...