angular - 'Headers' has no properties in common with type 'RequestOptionsArgs' -
i upgraded angular libraries 4.3.6 , tslint 5.7.0 , below error while building angular app .
i not using requestoptionsargs in code below below error
error
type 'headers' has no properties in common type 'requestoptionsargs'. my angular service code below
import { injectable } '@angular/core'; import {summary} './summary'; import {http, headers, response} '@angular/http'; import { observable } 'rxjs/observable'; import {selectitem} "primeng/primeng"; import {exceptionhandle} "../util/exceptionhandle"; import {myconst} "../util/constants"; @injectable() export class myservice { private myurl= myconst.reconurl.url; private headers: headers = new headers({"content-type'" : 'application/json', 'accept': 'application/json', 'access-control-allow-origin':'*', 'access-control-allow-credentials':'true' }); getsummaries(): observable<summary[]> { return this.http.get(this.reconurl + '/summaries', this.headers) .map((response: response) => <summary[]> response.json()) .catch(this.handleerror); } private handleerror(error: any): promise<any> { return exceptionhandle.handleerror(error); } }
you passed headers parameter in wrong place. should pass headers property of requestoptionsargs object in http.get method
return this.http.get(this.reconurl + '/summaries', { headers: this.headers })
Comments
Post a Comment