【发布时间】:2021-06-28 11:50:32
【问题描述】:
我想传递一个变量的值,如果它为空,那么在 Angular 中调度它时自动将其值设置为 0
this.myForm = this.formBuilder.group({
id: [null, Validators.required],
productPrice: [0],
finalPrice: [0],
remarks: [null],
});
onCreate(form: FormGroup) {
console.log(form.value)
this.store.dispatch(form.value)
}
【问题讨论】:
标签: angular ecmascript-6 angular-reactive-forms