当我试图使用一个带有控件的窗体时,我得到了这个错误。 Type 'AbstractControl' is missing the following properties from type
'FormControl': registerOnChange, registerOnDisabledChange, _applyFormState 表单代码 this.checkoutForm = this.fb.group({
firstName: ['', [Validators.required, Validators.patt
我有一个反应式。在编辑时,我想禁用一个控件。
以下是工作原理:
this.myForm.controls['analysis_horizon'].disable();
但是,密钥analysis_horizon不再在我的myForm.value散列中。
如何禁用具有反应式表单的字段,但保持表单值的哈希值?
我尝试过disabled=,但得到的结果如下:
It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to tr
嗨,有人能告诉我为什么我收到像我的标题一样的错误吗?我使用表单生成器,并且我在我自己的模块和我的应用程序模块中导入了反应式表单模块和表单模块,但仍然得到错误l无法绑定到'formGroup‘,因为它不是' form’的已知属性 my Component my Template my own module app module
我在Angular中实现了一个反应式表单,如果表单组的一个控件无效,我会在原生元素中滚动(但访问原生元素还有很多其他原因,这只是其中之一)。 我期望得到这样的API: for (const key in this.formGroup) {
const control = this.formGroup[key];
if (!control.valid) {
control.nativeElement.scrollIntoView();
}
} 但是,太糟糕了,它不存在任何像FormControl.prototype.nativeElement这样的属性。 考虑到表单很大并且
我需要使用angular react创建一个动态表单。但此for具有许多子窗体组,这些组可能会随窗体选择框值的不同而变化。
profileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
department: new FormControl('')
});
部门类型为'a', 'b', 'c'。
如果用户选择'a',我将在prof
由于特殊情况,我需要在提交函数中重新验证表单。敬请指教。谢谢你。
onSubmit() {
this.myForm.updateValueAndValidity();
someObservable() // what to put here?
.subscribe((stillValid: boolean) => {
if (stillValid) send();
}
}