【发布时间】:2018-09-15 05:38:26
【问题描述】:
我没有从 Angular 6 应用程序接收到关于 asp.net mvc core api 的数据。 图片在这里 MVC core api
httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
createUser(user: User): Observable<any> {;
let body = JSON.stringify(user);
return this.http.post<any>('http://localhost:51001/api/User/' + "PostUser", body, this.httpOptions)
.pipe(catchError(this.handleError));
}
【问题讨论】:
-
向我们展示代码! 在此处发布相关的 Angular 和 Web API 代码 - 作为文本,格式正确。
-
请注意,不需要添加
Content-Type标头,因为 Angular 会为您添加此标头
标签: c# .net angular asp.net-core-mvc