.share() with .subscribe() _isScalar is missing

Viewed 16454

I am trying to use share() with subscribe() but got error message as follow. Initially, i started with subscribe. How can this be fix?

My intention is to execute the logic in subscribe. Share is needed to prevent multiple call with async pipe.

Type 'Subscription' is not assignable to type 'Observable'.
Property '_isScalar' is missing in type 'Subscription'. (property) PostDetailPage.post: Observable

 this.post = this.data.getPostById(this.postId).share().subscribe(data => {
          this.post = data;
      },
      err => {
          console.log("Oops!");
      })
1 Answers
Related