我需要使用angular react创建一个动态表单。但此for具有许多子窗体组,这些组可能会随窗体选择框值的不同而变化。
profileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
department: new FormControl('')
});
部门类型为'a', 'b', 'c'。
如果用户选择'a',我将在prof
我在Angular中实现了一个反应式表单,如果表单组的一个控件无效,我会在原生元素中滚动(但访问原生元素还有很多其他原因,这只是其中之一)。 我期望得到这样的API: for (const key in this.formGroup) {
const control = this.formGroup[key];
if (!control.valid) {
control.nativeElement.scrollIntoView();
}
} 但是,太糟糕了,它不存在任何像FormControl.prototype.nativeElement这样的属性。 考虑到表单很大并且
我已经阅读了所有的帖子,“Can't bind to 'ngModel' since it isn't a known property of 'input'”的解决方案似乎是将FormsModule添加到imports和app.module.ts中的imports数组(我在应用程序中只有一个模块。..。..。app.module.ts)。但我已经尝试过了,以及多种排列,包括将它们导入到git-search-component.spec.ts,以及导入ReactiveFormsModule等,但都不起作用,并且我在控制台中仍然收到"ca