Property 'json' does not exist on type '{}'
You can get rid of this error by type-assertion to Response
:
.map((res: Response) => res.json())
http.post()
will return a Observable<Response>
on wich map
will require an Object of type Response
. I think that's a missing definition in the current TypeScript AngularJS .d.ts
.
To me this looks strange...
.map(res => (<Response>res).json())
I would do
.map((res: Response) => res.json())