i am new to the angular i tried to make this work, here the "confirmDoctor" function is making some changes through the api, now i want the the way to automatically refresh the page of some angular change detection, so that it will call the getInfo method again give me the updated value. right now i have to manually refresh my browser to see the change.
async confirmDoctor(selectedDoctor:string,pid:string){
console.log(selectedDoctor);
await this.assign.AssignDoctor(selectedDoctor,pid).subscribe(
(response)=>{
console.log(response);
})
}
ngOnInit(){
this.getinfo.getInfo('patient').subscribe((response)=>
{
this.data = response;
console.log(this.data);
})
this.doc$ = this.getinfo.getInfo('doctor');
}
}
as i am new to the angular i dont really know what i need, i tried some change detection methods but i couldn't do it, what worked is calling ngOnInit() again inside the function, but i dont think its the right solution.
put the "this.getinfo.getInfo(..." in a separate private method for example:
call this in ngOnInit(), and similarly inside the subscription block of confirmDoctor()