ngx-datatable: Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'.

I’m submitting a … (check one with “x”)

[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior I get a run time error with the following error - ‘ngx-datatable’ is not a known element:

Expected behavior Is that the application would render grid

Reproduction of the problem I followed the direction on this page https://swimlane.gitbooks.io/ngx-datatable/content/introduction/getting-started.html to install the component.

What is the motivation / use case for changing the behavior? Not sure if there is something I am doing wrong or if there is a bug

  • Table version: 0.8.x 8.0.0

  • Angular version: 2.0.x 4.0.1

Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] IE, Chrome, FireFox - would expect same behavior from other browsers

Language: TypeScript 2.0.3, Angular 4

Steps -

Had working running application Used npm to download Angular 4 Used npm to download ngx-datatable Followed the direction from here https://swimlane.gitbooks.io/ngx-datatable/content/introduction/getting-started.html to install the component. Compiles but get the runtime error

Full Error: Can’t bind to ‘rows’ since it isn’t a known property of ‘ngx-datatable’.

  1. If ‘ngx-datatable’ is an Angular component and it has ‘rows’ input, then verify that it is part of this module.
  2. If ‘ngx-datatable’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
  3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component. (" </div> </div>--> <ngx-datatable [ERROR ->][rows]="rows" [columns]="columns"> </ngx-datatable>

"): ng:///AdminModule/AdminComponent.html@659:19 Can’t bind to ‘columns’ since it isn’t a known property of ‘ngx-datatable’.

  1. If ‘ngx-datatable’ is an Angular component and it has ‘columns’ input, then verify that it is part of this module.
  2. If ‘ngx-datatable’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
  3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component. (" </div>--> <ngx-datatable [rows]="rows" [ERROR ->][columns]="columns"> </ngx-datatable>
</div> "): ng:///AdminModule/AdminComponent.html@660:19 'ngx-datatable' is not a known element: 1. If 'ngx-datatable' is an Angular component, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div>--> [ERROR ->]<ngx-datatable [rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:4 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors: Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'rows' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div> </div>--> <ngx-datatable [ERROR ->][rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:19 Can't bind to 'columns' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'columns' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div>--> <ngx-datatable [rows]="rows" [ERROR ->][columns]="columns"> </ngx-datatable> </div> "): ng:///AdminModule/AdminComponent.html@660:19 'ngx-datatable' is not a known element: 1. If 'ngx-datatable' is an Angular component, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div>--> [ERROR ->]<ngx-datatable [rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:4 at syntaxError (http://localhost:8080/dist/app.bundle.js:56812:34) [<root>] at TemplateParser.parse (http://localhost:8080/dist/app.bundle.js:66821:19) [<root>] at JitCompiler._compileTemplate (http://localhost:8080/dist/app.bundle.js:80539:39) [<root>] at http://localhost:8080/dist/app.bundle.js:80463:62 [<root>] at Set.forEach (native) [<root>] at JitCompiler._compileComponents (http://localhost:8080/dist/app.bundle.js:80463:19) [<root>] at createResult (http://localhost:8080/dist/app.bundle.js:80348:19) [<root>] at Zone.run (http://localhost:8080/dist/app.bundle.js:107191:43) [<root> => <root>] at http://localhost:8080/dist/app.bundle.js:107826:57 [<root>] at Zone.runTask (http://localhost:8080/dist/app.bundle.js:107231:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:8080/dist/app.bundle.js:107659:35) [<root>] Error: Template parse errors: Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'rows' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div> </div>--> <ngx-datatable [ERROR ->][rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:19 Can't bind to 'columns' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'columns' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div>--> <ngx-datatable [rows]="rows" [ERROR ->][columns]="columns"> </ngx-datatable> </div> "): ng:///AdminModule/AdminComponent.html@660:19 'ngx-datatable' is not a known element: 1. If 'ngx-datatable' is an Angular component, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div>--> [ERROR ->]<ngx-datatable [rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:4 at syntaxError (http://localhost:8080/dist/app.bundle.js:56812:34) [<root>] at TemplateParser.parse (http://localhost:8080/dist/app.bundle.js:66821:19) [<root>] at JitCompiler._compileTemplate (http://localhost:8080/dist/app.bundle.js:80539:39) [<root>] at http://localhost:8080/dist/app.bundle.js:80463:62 [<root>] at Set.forEach (native) [<root>] at JitCompiler._compileComponents (http://localhost:8080/dist/app.bundle.js:80463:19) [<root>] at createResult (http://localhost:8080/dist/app.bundle.js:80348:19) [<root>] at Zone.run (http://localhost:8080/dist/app.bundle.js:107191:43) [<root> => <root>] at http://localhost:8080/dist/app.bundle.js:107826:57 [<root>] at Zone.runTask (http://localhost:8080/dist/app.bundle.js:107231:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:8080/dist/app.bundle.js:107659:35) [<root>] consoleError @ zone.js:569 handleUnhandledRejection @ zone.js:574 _loop_1 @ zone.js:609 drainMicroTaskQueue @ zone.js:613 zone.js:571 Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'rows' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div> </div>--> <ngx-datatable [ERROR ->][rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:19 Can't bind to 'columns' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'columns' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div>--> <ngx-datatable [rows]="rows" [ERROR ->][columns]="columns"> </ngx-datatable> </div> "): ng:///AdminModule/AdminComponent.html@660:19 'ngx-datatable' is not a known element: 1. If 'ngx-datatable' is an Angular component, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div>--> [ERROR ->]<ngx-datatable [rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:4 Error: Template parse errors: Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'rows' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div> </div>--> <ngx-datatable [ERROR ->][rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:19 Can't bind to 'columns' since it isn't a known property of 'ngx-datatable'. 1. If 'ngx-datatable' is an Angular component and it has 'columns' input, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" </div>--> <ngx-datatable [rows]="rows" [ERROR ->][columns]="columns"> </ngx-datatable> </div> "): ng:///AdminModule/AdminComponent.html@660:19 'ngx-datatable' is not a known element: 1. If 'ngx-datatable' is an Angular component, then verify that it is part of this module. 2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" </div> </div>--> [ERROR ->]<ngx-datatable [rows]="rows" [columns]="columns"> </ngx-datatable> "): ng:///AdminModule/AdminComponent.html@659:4 at syntaxError (http://localhost:8080/dist/app.bundle.js:56812:34) [<root>] at TemplateParser.parse (http://localhost:8080/dist/app.bundle.js:66821:19) [<root>] at JitCompiler._compileTemplate (http://localhost:8080/dist/app.bundle.js:80539:39) [<root>] at http://localhost:8080/dist/app.bundle.js:80463:62 [<root>] at Set.forEach (native) [<root>] at JitCompiler._compileComponents (http://localhost:8080/dist/app.bundle.js:80463:19) [<root>] at createResult (http://localhost:8080/dist/app.bundle.js:80348:19) [<root>] at Zone.run (http://localhost:8080/dist/app.bundle.js:107191:43) [<root> => <root>] at http://localhost:8080/dist/app.bundle.js:107826:57 [<root>] at Zone.runTask (http://localhost:8080/dist/app.bundle.js:107231:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:8080/dist/app.bundle.js:107659:35) [<root>] at syntaxError (http://localhost:8080/dist/app.bundle.js:56812:34) [<root>] at TemplateParser.parse (http://localhost:8080/dist/app.bundle.js:66821:19) [<root>] at JitCompiler._compileTemplate (http://localhost:8080/dist/app.bundle.js:80539:39) [<root>] at http://localhost:8080/dist/app.bundle.js:80463:62 [<root>] at Set.forEach (native) [<root>] at JitCompiler._compileComponents (http://localhost:8080/dist/app.bundle.js:80463:19) [<root>] at createResult (http://localhost:8080/dist/app.bundle.js:80348:19) [<root>] at Zone.run (http://localhost:8080/dist/app.bundle.js:107191:43) [<root> => <root>] at http://localhost:8080/dist/app.bundle.js:107826:57 [<root>] at Zone.runTask (http://localhost:8080/dist/app.bundle.js:107231:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:8080/dist/app.bundle.js:107659:35) [<root>] at resolvePromise (http://localhost:8080/dist/app.bundle.js:107778:31) [<root>] at resolvePromise (http://localhost:8080/dist/app.bundle.js:107749:17) [<root>] at http://localhost:8080/dist/app.bundle.js:107826:17 [<root>] at Zone.runTask (http://localhost:8080/dist/app.bundle.js:107231:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:8080/dist/app.bundle.js:107659:35) [<root>]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (1 by maintainers)

Most upvoted comments

I could fix the issue. May seem strange but it worked like this. My app is multi-modular , I imported NgxDatatableModule in the root module and it was giving me the error. I then imported it in the child module , it worked 😃

@PeterSawyer:

did you import NgxDatatableModule to your *.spec.ts?

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent],
      imports: [
        NgxDatatableModule ]

Here you go Austin,

I am only a newby with ng2 and cannot seem to attach a zip to this ticket of example but to recreate this issue took only a few minutes as per the below steps.

Versions

$ npm --version
4.5.0

$ ng --version
@angular/cli: 1.0.0
node: 7.8.0
os: darwin x64

Create new project and test

$ ng new test-karma-error
…
Successfully initialized git.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Project 'test-karma-error' successfully created.

test-karma-error (master) $ ng test

11 05 2017 07:54:23.088:WARN [karma]: No captured browser, open http://localhost:9876/  
11 05 2017 07:54:23.109:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
11 05 2017 07:54:23.109:INFO [launcher]: Launching browser Chrome with unlimited concurrency
11 05 2017 07:54:23.136:INFO [launcher]: Starting browser Chrome
11 05 2017 07:54:24.103:INFO [Chrome 57.0.2987 (Mac OS X 10.12.4)]: Connected on socket pFV7Jo9v1QKv0O7_AAAA with id 92377930
Chrome 57.0.2987 (Mac OS X 10.12.4): Executed 3 of 3 SUCCESS (0.19 secs / 0.174 secs)

Install Swimlane ngx-datatable

test-karma-error (master) $ npm i @swimlane/ngx-datatable --save
test-karma-error@0.0.0 /Users/peter/test-karma-error
└── @swimlane/ngx-datatable@9.1.0 

app.module.ts

import { NgxDatatableModule } from '@swimlane/ngx-datatable';
imports: [
  …
  NgxDatatableModule,
],

app.component.html

<div>
  <ngx-datatable
    [rows]="rows"
    [columns]="columns">
  </ngx-datatable>
</div>

app.component.ts

  rows = [
    { name: 'Austin', gender: 'Male', company: 'Swimlane' },
    { name: 'Dany', gender: 'Male', company: 'KFC' },
    { name: 'Molly', gender: 'Female', company: 'Burger King' },
  ];
  columns = [
    { prop: 'name' },
    { name: 'Gender' },
    { name: 'Company' }
  ];

Run it

test-karma-error (master) $ ng serve
** NG Live Development Server is running on http://localhost:4200 **
 11% building modules 15/26 modules 11 active ...de_modules/css-loader/lib/css-base.jswebpack: wait until bundle finished: /
Hash: 3c7c0f032a045d5629fa                                                              
Time: 8488ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 157 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 4.19 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.79 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.

Test it

test-karma-error (master) $ ng test
11 05 2017 08:02:27.455:WARN [karma]: No captured browser, open http://localhost:9876/  
11 05 2017 08:02:27.468:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
11 05 2017 08:02:27.468:INFO [launcher]: Launching browser Chrome with unlimited concurrency
11 05 2017 08:02:27.496:INFO [launcher]: Starting browser Chrome
11 05 2017 08:02:28.284:INFO [Chrome 57.0.2987 (Mac OS X 10.12.4)]: Connected on socket ZKXzp4OCJgCJruHAAAAA with id 89361783
Chrome 57.0.2987 (Mac OS X 10.12.4) AppComponent should create the app FAILED
	Can't bind to 'rows' since it isn't a known property of 'ngx-datatable'.
	1. If 'ngx-datatable' is an Angular component and it has 'rows' input, then verify that it is part of this module.
	2. If 'ngx-datatable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
	3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
	<div>
	  <ngx-datatable
	    [ERROR ->][rows]="rows"
	    [columns]="columns">
	  </ngx-datatable>
	"): ng:///DynamicTestModule/AppComponent.html@6:4
…………..

Dropbox link run an npm update

Hope this helps Regards

Hi,

I was getting this error and it was due to my setup. I had done everything in getting started guide but still was getting this error. The component where I was adding the code had is own module ts file and once I add the NgxDatatableModule to that module file as well it started working.

If your components have there own module files you will need to add the NgxDatatableModule import statement into that file as well.

Regards, Colin

ES->Tuve el mismo error. Solucionado importando el módulo en cada uno de los módulos hijos de la aplicación como sugería @kalyandas EN-> I had the same error. Advice of @kalyandas worked for me. Thanks.

I get passed that issue by writing [attr.rows]="rows" instead of just [rows] though, my error is Error: Template parse errors: 'ngx-datatable' is not a known element