【发布时间】:2020-04-11 19:57:29
【问题描述】:
如何为反应形式提交的日期设置 null。我试过但没有工作。任何知道的人请帮助找到解决方案。
app.component.html:
<input type="text" class="form-control" formControlName="publishdate" ngbDatepicker #datepicker="ngbDatepicker">
app.component.ts:
this.registerForm = this.fb.group({});
this.registerForm.addControl('publishdate', new FormControl('', null));
【问题讨论】:
-
为什么不在组函数中声明日期?如:this.registerForm = this.fb.group({publishdate: ['']});
-
@ManirajMurugan:是的..知道了。谢谢
标签: angular6 angular7 angular-reactive-forms