要解决Angular 12的ReactiveFormsModule的奇怪现象,可以尝试以下几个步骤:
import { ReactiveFormsModule } from '@angular/forms';
@NgModule({
imports: [
ReactiveFormsModule
],
// ...
})
export class AppModule { }
import { Component } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
@Component({
selector: 'app-my-component',
template: `
`
})
export class MyComponent {
myForm: FormGroup;
constructor() {
this.myForm = new FormGroup({
myControl: new FormControl()
});
}
}
如果你能提供更具体的代码示例或错误信息,我可以更准确地帮助你解决问题。