I am trying to use the requestDetails variable outside the subscribe method but its showing "undefined"
service.ts
requestDetails$ = new Subject<any>();
updateApprovalMessage(message: string) {
this.requestDetails$.next(message)
}
component.ts
requestDetails:any
this.technicalRequestService.requestDetails$.subscribe(data=>{
this.requestDetails=data
console.log(this.requestDetails)
//here it is printing
}
console.log(this.requestDetails)
//but its is showing undefined