I have spent hours trying different ways to get this Observable to work in ionic / angular. I have tried different setups and interfaces to plugin to Observable which has properties which are strings. I have tried plugging in JSON as an interface. I simply need to do a GET to an https server with extra parameters. I keep getting errors stating that essentially the returned http cannot properly be typed to the observable defined in getGP.
error is
When removing the subscribe I get an almost identical error when JSON isnt used as an interface. A simple GET/POST is easy to do in vanilla and angular is driving me nuts. I also need to save the response in a variable and inject the data into another module. I have looked through the rxjs docs and just at a loss. Help would be appreciated.
I am running the latest angular and the latest ionic framework.
import { HttpClient, HttpHeaders } from '@angular/common/http';
getGP(): Observable<JSON> {
this.httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'token': 'token',
'mtype': 'g',
})
}
return this.http.get<JSON>(this.base_path + '/pathtoserver', this.httpOptions).subscribe(res => console.log(res))
}