angular2 testing: Can't bind to 'ngModel' since it isn't a known property of 'input'
You need to import the FormsModule
into the TestBed
configfuration.
import { FormsModule } from '@angular/forms';
TestBed.configureTestingModule({
imports: [ FormsModule ],
declarations: [
AppComponent
],
providers:[AppService]
});
What you are doing with the TestBed
is configuring a NgModule from scratch for the test environment. This allows you to only add what is needed for the test without having unnecessary outside variables that may affect the test.