我的'form'中的表单值与from i甚至必须发送存储在localhost中的id。我可以这样做.........任何人都建议帮助....
onSubmit(form){
console.log(form);
var str = localStorage.getItem('social');
var loc = JSON.parse(str);
var profile_id = loc.profile_id;
var headers = new Headers();
headers.append('Content-Type','application/x-www-form-urlencoded')
this.http.post('http://localhost/angular/index.php/profile/addaddress', JSON.stringify(form),{headers:headers})
.subscribe(
response => {
if(response.json().error_code ==0){
alert('added successfully');
}
else{
alert('fail');
}
})
}
}
答案 0 :(得分:0)
onSubmit(form){
...
var profile_id = loc.profile_id;
form.profile_id=prifile_id;
...
}