Here is the component method I am using:
if (id !== undefined && id != null && id !== 0) {
this.dataService.getTransactionById(id).subscribe(
(tr: ITransactionResponse) => {
if (tr != null) {
this.transaction = tr;
}
else {
this.router.navigate(['/']);
}
});
Deprecated: Unfortunately, I have noticed that this method has been marked as deprecated in my Angular project. Could you please suggest any changes to update it?
EDIT :
I have updated my method with the following code (using RXJS 6)
this.tranService.getTransactionById(id).subscribe({
next: (result: any) => {
this.transaction = result;
},
error: (error:any) => {
this.router.navigate(['/transaction/transaction-list']);
},
complete: () => {
//console.log('complete');
}
});
Despite the update, the method still shows as deprecated.