Error: Export of name 'ngModel' not found

izeko picture izeko · Aug 30, 2019 · Viewed 14.1k times · Source

After building my angular project i get the error: Error: Export of name 'ngModel' not found!

I have my UI running in a docker container

not even sure where to look for this. Its working fine in dev. (ng serve)

Any ideas

Answer

Ram A K picture Ram A K · May 18, 2020

import FormsModule in your respective spec.ts file and app.module.ts if not

beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports:[RouterTestingModule,HttpClientTestingModule,FormsModule],
      declarations: [ MyComponent ]
    })
    .compileComponents();
  }));