I have the following code in my service file:
getPubs(): Observable<pubs[]> {
return this.http
.get(this._url)
.map((response: Response) => {
return <pubs[]>response.json();
})
.catch(this.handleError);
}
I have an error on this line return <pubs[]>response.json();
*ERROR in node_modules/@angular/common/http/src/module.d.ts(88,23): error
TS1183: An implementation cannot be declared in ambient contexts.*
*src/app/services/pubs.service.ts(18,16): error TS2352: Conversion of type
'Promise<any>' to type 'pubs[]' may be a mistake because neither type
sufficiently overlaps with the other. If this was intentional, convert the
expression to 'unknown' first.*
* Type 'Promise<any>' is missing the following properties from type
'pubs[]': length, pop, push, concat, and 26 more.*
Please help
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.