I would like to getting the latest value. There are 2 API. one is updatePhoneNo and another one is getPhoneValue. After I called updatePhoneNo API, the getPhoneValue is loaded and updated the latest value. But the html page is not update. How to solve it?
TS:
projects$: Observable<CustDetaill>;
ngOnInit() {
this.projects$ = this.custService.getPhoneValue(this.custno);
}
update(){
this.custService.updatePhoneNo(this.custphoneno).subscribe(
res => {
this.projects$.next(this.custphoneno);
});
}
HTML
{{(projects$ |async)?.phoneNo}}
CodePudding user response:
i think you should treat it as observable and use it from the typeScript like this
this.projects$.next(newValue);
update
i saw your edit .. ok first you need to change type projects$
projects$: BehaviorSubject<CustDetaill>;
and make it takes its value with the "next" key work i wrote an example for you .. hope it can help