Angular2 Quickstart Tutorial Breaking Karma Tests - “Can't bind to 'ngModel' since it isn't a known property of 'input'.”

旧城冷巷雨未停 提交于 2019-12-04 22:34:53

When configuring the test using the TestBed, it's like configuring an @NgModule from scratch for the testing environment. So when adding AppComponent to the declarations, and the AppComponent needs forms directives, you need to import the FormsModule into to the testbed configuration, just you do in the AppModule

TestBed.configureTestingModule({
  declarations: [ AppComponent ],
  imports: [ FormsModule ]
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!