Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why am I getting this error? TypeError: this.lasService.getLasDropDownOptions(…).pipe is not a function

This returns the dropdown options available to be displayed. I’m assuming the problem is with the .pipe but I can’t seem to correct it.

        return this.lasService.getLasDropDownOptions(true)
          .pipe(takeUntil(this.unsubscribe))
          .subscribe((lasOptions) => {
            return resolve(lasOptions.map((option) => {
              return option || [];
            }));
          });
      }
   

 getLasDropDownOptions(refresh) {
    return this.getLasData(refresh)
      .pipe(takeUntil(this.unsubscribe))
      .subscribe((response) => {
        return response.map((las) => {
          las.displayValue = las.name + ' - ' + las.expression;
          if (!las.status) {
            las.disabled = true;
            las.category = 'Calculating';
          } else {
            las.category = las.longterm ? 'Online Range' : 'Short Term';
          }
          return las;
        });
      });
  } ```

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Because your service method returns a Subscription, not an observable. You should use the map operator in your service method and not .subscribe to the observable there.

getLasDropDownOptions(refresh) {
  return this.getLasData(refresh).pipe(
    takeUntil(this.unsubscribe),
    map((response: any[]) => {
      return response.map((las) => {
        las.displayValue = las.name + " - " + las.expression;
        if (!las.status) {
          las.disabled = true;
          las.category = "Calculating";
        } else {
          las.category = las.longterm ? "Online Range" : "Short Term";
        }
        return las;
      });
    })
  );
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading