【发布时间】:2018-11-14 15:14:24
【问题描述】:
我在 Angular 6 中有一项服务,我正在尝试更改记录,但它说我没有被授权。
现在我有这个:
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
update(id, title, content) {
const updateData = { id: id, title: title, content: content };
return this.http.put(`http://myurl/${id}`, updateData, httpOptions);
}
我的问题是:
如何将基本授权添加到我的 httpOptions 或将其直接添加到更新方法?
【问题讨论】:
标签: angular typescript angular6