I keep getting this error while using TypeScript\'s Angular2-forms framework:
There is no
directive
with \"exportAs\" set to \"ngForm
This error also occurs if you are trying to write a unit test case in angular using jasmine.
The basic concept of this error is to import FormsModule
. Thus, in the file for unit tests, we add imports Section and place FormsModule in that file under
TestBed.configureTestingModule
For eg:
TestBed.configureTestingModule({
declarations: [ XYZComponent ],
**imports: [FormsModule]**,
}).compileComponents();