service.ts
@Injectable({
providedIn:'root'
})
export class textAppService{
constructor(private http: HttpClient){}
getPersonDetail(id:any):Observable<any>{
return id? this.http.post(ur;, {id:id}):of(new personDetails());
}
}
· In order to optimize time efficiency, you want to pass the data retrieved from the getPersonDetail() method to a separate, unrelated component's TypeScript file. However, calling the getPersonDetail() service directly is not feasible in this scenario. One solution could be to set the data obtained from getPersonDetail as a global object, allowing it to be accessed and utilized by multiple components. How would you achieve this?