Is there a way to retrieve the value of this.dealType outside of the this.trasactionService.transactionEvent$ subscription? I need to access the data and value of this.dealType elsewhere, any help would be appreciated.
While it has a value inside the this.trasactionService.transactionEvent$.subscribe method, I am struggling to access it outside. Even when using console logs, the value appears empty.
I thank you in advance for your assistance.
#code
export class DealsApprovalComponent implements OnInit {
dealType: string;
totalDealsForApproval = 0;
constructor(
private dealService: DealService,
private notificationService: NotificationService,
private trasactionService: TransactionService,
private route: Router,
private dealTransactionService: DealTransactionService
)
{
}
ngOnInit(): void {
this.trasactionService.transactionEvent$.subscribe((data) => {
if(data) {
switch (data['operation']) {
case 'deal/deal-type':
this.dealType = data["dealType"];
break;
}
}
},
(error) => {}
);
console.log("this.dealType" , this.dealType)
}