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

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


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();  }));


As The Aelfinn pointed out if you are using your Component across Modules you need to export it. BUT you should not import, export and declare it in the Module you want to use it, since its not part of this Module !!!
So suppose you have a TreeViewStuffModule which declares the TreeViewComponent and a DoSomethingWithTreeViewModule where the TreeViewComponent is used in, your declarations would be as follows:

@NgModule({  declarations: [    TreeViewComponent  ],  exports: [    TreeViewComponent  ]})export class TreeViewStuffModule { }@NgModule({  imports: [    TreeViewStuffModule  ]})export class DoSomethingWithTreeViewModule