onSubmit(Values from form here?){
this.http.post("A URL", legacyURL).subscribe();
}
答案 0 :(得分:1)
您应该使用HttpParams库在请求标头中添加多个参数。
import { HttpClient, HttpParams } from '@angular/common/http';
onSubmit(values val){
let params = new HttpParams()
.set('username', val.username)
.set('password', val.password)
this.http.post("A URL", params).subscribe();
}
答案 1 :(得分:0)
根据您的问题,如果我的理解是正确的,那么您想在发出发布请求时传递参数。
您可以执行以下操作:
const val = this.form.value;
this.http.post('url', {
first_name: val.first_name,
last_name: val.last_name,
email: val.email,
})
.subscribe(response => {
});