Angular 4 Can't bind to <property> since it isn't a known property of <component>

Every component, directive, and pipe needs to be registered in @NgModule()

@NgModule({
  declarations: [TreeViewComponent]
})
export class AppModule {}

For more details see

  • https://angular.io/api/core/NgModule
  • https://angular.io/guide/ngmodules
  • https://angular.io/guide/ngmodule-api

I've the same error, when run test for ParentComponent. Inside was ChildComponent component with @Input property: string;. Both components were also declared inside app.module.ts.

I've fixed this like that (parent component test file):

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ParentComponent, ChildComponent]// added child component declaration here
    })
      .compileComponents();
  }));