How does this code change wrt to the new HttpClientModule, where no mapping from response.json () is required.
//uses Http
getLegalTerms(): Observable<legalterm[]> {
return this._http.get(this._legalTermUrl)
.map((response: Response) => <legalterm[]> response.json());
}
I get nothing if I do the following
getLegalTerms(): Observable<legalterm[]> {
return this._http.get<legalterm[]>(this._legalTermUrl)
}
I subscribe to the component class in the same way anyway
ngOnInit() {
this._legalTermService.getLegalTerms()
.subscribe((legalTerms: LegalTerm[]) => {
this.legalTerms = legalTerms;
})
}
I get data in a grid with Http, but no data in a grid with HttpClient
Thank! Anand
Anand source
share