0
let headers1 = new Headers({'Content-Type': 'application/json'});
headers1.append('X-Authorization','some code');
let options = new RequestOptions({ headers: headers1,body: {} });
this.http.get('http://locahost:8080/dmat/logmgr/v1/reports/all?calFilterType=Day&date=2017-05-05'+paramerter, options).subscribe(
(data => {
if(data.json().status === '200'){
console.log('data',data);
}else {
};
})
);
控制檯中沒有錯誤。但我無法在chrome中的網絡選項卡下的請求標題選項卡中看到我的標題。
這是我的服務文件 私人頭文件:any; (私人http:http){ this.headers = } \t private getReports ='reports/all?calFilterType = Day&date = 2017-05-05'; getLogData(參數:任何)//this.headers.append('Content-Type','application/json'); this.headers.append('X-Authorization','SOME TOKEN'); \t \t return this.http.get(this.Url + this.getReports + parameter,{headers:this.headers}).map((res:Response)=> res.json()); } –
THIS IS MY FILE及部件從那裏我打電話本服務 公共getLogData(值:任何){ this.logManagerService.getLogData(值).subscribe( 數據=> { this.testResponse =數據; 控制檯.log(「我可以看到這裏的數據:」,this.testResponse); } ); –