sách gpt4 ai đã đi

angular - 在 Angular4 和 Material2 中提交表单

In lại Tác giả: Space Dog 更新时间:2023-10-29 17:27:04 27 4
mua khóa gpt4 Nike

我尝试使用 Angular 4.0.0 和 Material 2 构建我的第一个登录表单。但是该表单不会提交并触发该功能。











提交函数:

onSubmit(value: any) {

console.log('sdfdfg');

Object.assign(value, this.additionalData);
this.submitted = true;

this.auth.login(value).subscribe(
data => {
this.loginSuccess.emit(data);
},
error => {
for (const field in this.formErrors) {
if (this.formErrors.hasOwnProperty(field)) {

this.formErrors[field] = [];
if (this.validationMessages[field].hasOwnProperty(error.systemCode)) {
this.formErrors[field].push(this.validationMessages[field][error.systemCode]);
}
}
}
}
);

}

当我单击登录按钮时,他不会将控制台日志打印到控制台中。知道为什么吗?

1 Câu trả lời

更改按钮类型="按钮"













onSubmit(form: ngForm) {

console.log('sdfdfg');
console.log(form.value);

}

关于angular - 在 Angular4 和 Material2 中提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44065405/

27 4 0
Bài viết được đề xuất: Python:拆分字符串,尊重并保留引号
Bài viết được đề xuất: c - while (*p2++ = *p1++); 是做什么的?意思?
Bài viết được đề xuất: python - numpy loadtxt 跳过第一行
Bài viết được đề xuất: angular - p-dialog onHide 在 Angular 2 组件中不起作用 - primeng
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com