1
我正在将Angular 2 Beta 9中的应用程序迁移到Angular 2 RC5,并且我遇到了大量的错误,我开始消除并且达到了我的控制台不显示任何内容的地步。Angular 2在POST请求上重新加载页面
然而,当我提交表单到轨服务器,页面只是重新加载和控制台迅速显示了一个错误,但我不能把它看作是低于其过快
反正代码的工作只是罚款公测版本,所以这是怎么回事错在这里的任何见解将是真棒(张贴只是相关部分)
onSubmit() {
this.myForm.value.systemParameters = this.system_arr;
this.myForm.value.liftOperator = this.lift_arr;
this.myForm.value.restrictOperator = this.restrict_arr;
this.myForm.value.param = this.param_arr;
this.myForm.value.xInitial = this.xinitial_arr;
let myForm = JSON.stringify(this.myForm);
let headers = new Headers();
headers.append('Content-Type', 'application/json');
this.http.post('http://localhost:3000/webhook', myForm, { headers: headers }).subscribe(
res => this.response = res.json(),
error => console.log(error)
);
console.log('your submitted value:', this.myForm.value);
}
包裹错误处理括号,所以你可以在那里坚持一个断点,看看是什么错误 – drewmoore
啊,你可以举个例子吗?不知道我得到它 –
取代'误差= > console.log(error)'with'error => {debugger; }',并且执行将在调试器行上暂停。或者单独离开'console.log',并在devtools中添加一个断点。我假设你知道如何使用chrome devtools? – drewmoore