observable deprecated in Angular component class in (RXJS 6.X)

Viewed 178

Below is my component method

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: But it showing as deprecated in my angular project. Please let me know what could by I change this method?

EDIT :

I Have changed my method to below code (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');
            }
          }); 

But Still showing Deprecated

Deprecated Infi

1 Answers
Related