【发布时间】:2018-04-04 20:36:11
【问题描述】:
Attached screenshot for more information about error
我正在使用 FormGroup 来创建表单控件,并且在将填充的数据提交到服务器后,我正在调用 form.reset() 方法来清除当前数据。 所以我想要的是,所有控件都应该像组件第一次初始化时一样呈现
html文件代码:
<mat-form-field>
<input matInput id="title" placeholder="Enter your title"
formControlName="title">
</mat-form-field>
TS 文件代码:
title: new FormControl("", Validators.compose([
Validators.required,
])),
【问题讨论】:
-
你能提供更多代码吗
-
点击提交功能时可以使用$scope.form={}重置输入字段
-
$scope.form = {} 在 Angular 4 中可用吗?