const httpOptions = {
headers: new HttpHeaders({'content-Type': 'text/plain'})
// headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
};
public save(user: TUser): void {
console.log('----------------save()-----------');
console.log(user.userName);
this.http.post('http://localhost:8080/users', JSON.stringify(user), httpOptions)
.subscribe(
res => {
console.log(res); //此處回傳null
},
err => {
console.log('Error occured');
}
);
發送資料時,總是回傳Null值,而查詢資料,使用Get時是,沒有什么問題,請各位大神,到底問題出在哪了呢?
網上各種辦法都嘗試后,問題依然不能解決。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/224670.html
標籤:其他
下一篇:一維陣列變為二維陣列
