I get the following error when I run a prod build on my Angular 9 app.
ERROR in Can't export value FormControl in from MaterialModule in as it was neither declared nor imported!
I have imported FormsModule and ReactiveForms Module in my App Module and a shared Module called
// Angular Material Components
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { ReactiveFormsModule, FormControl } from '@angular/forms';
const MatModules = [
ReactiveFormsModule,
FormControl,
FormsModule,
]
@NgModule({
declarations: [ ],
imports : [
FormsModule,
ReactiveFormsModule
],
exports : [ MatModules ]
})
export class MaterialModule { }
Kindly let me know what I am missing.
Thanks!
Warm Regards, Adi
My question is: why you want export FormControl? You don't need import/export FormControl, you just need to import ReactiveFormsModule and you will be able to use FormControl.