I am trying to retrieve some data with HttpClient in Angular. My code looks like as follows:
getData(suffurl: string, id?:number): Observable<any[]> {
return this.http.get<any[]>('localhost:5555/DNZ/'+ this.suff_url)
.pipe(
tap(data => console.log("Anlagenstatus Daten:", data)),
catchError(this.handleError('getData',[])),
subscribe(Response => { console.log(Response)})
)
}
However, I cannot use subscribe in the pipe method, or chain it before or after the .pipe method. The problem is, that without subscribe, it seems this code is not returning any data from the url or logging anything to the console although the link and the data exists?
any
? Wouldn't it be nice to know what the array actually contains? – Dybbukasync
Promise
Observable
orhttp.request
questions another pops up. Staunch the bleeding! Bail out! – Shebat