【发布时间】:2018-04-26 22:45:23
【问题描述】:
我有代码:
const parameters = 'Account/GetDoctorDetails?userId=' + 63;
this.http.get(`${webserviceUrlLocalHost}` + parameters)
.subscribe(response => {
console.log('response.json()');
console.log(response.json());
我想在这个调用中插入一个令牌到 GET webapi 调用中,所以我将代码更改为:
const headers = new Headers({ 'Authorization': `Bearer ` + token });
const options2 = new RequestOptions({ headers: headers });
return this.http.get('http://localhost:55803/Account/GetDoctorDetails?userId=63', options2)
.subscribe( response => console.log(response.json())); */
但是函数永远不会被调用;知道为什么它不起作用吗?
【问题讨论】: