Sometimes, even though we are already imported BrowserModule
, FormsModule
and other related modules, we still may get the same error.
Then I realized that we need to import them in order, which is missed in my case. So the order should be like BrowserModule
, FormsModule
, and ReactiveFormsModule
.
As per my understanding, feature modules should follow the basic modules of Angular.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule
],
providers: [],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule {}