Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49107

Property subscribe does not exist on type '(term:string) => Observable'

$
0
0

@jeandemagny wrote:

I get the data from my server like so :slight_smile:

  private allData(input:string): Observable<any> {
        let params = new HttpParams().set('q', input);
        return this.httpClient.get(Configuration.getData(url), { params: params });
    }

    public getDataService(){
        return this.dataService = (term: string) => this.allData(term);
    }

and in my controller, i would like to check the status of the request above to execute a specific UI action. Here is how i subscribe my data:

this.getDataService().subscribe(
      res => this.httpData = res.results,
      err => console.warn(err),
      () => {
        this.loading.dismiss() /*close loader*/
      }
  )

I have this error :“Property subscribe does not exist on type ‘(term:string) => Observable’”

Any help :slight_smile: ?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49107

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>