简体   繁体   中英

'ngx-datatable-column' is not a known element - Angular 8 ngx-datatable

I am trying to create a sample applicaiton with Angular 8 and using ngx-datatable. I am constantly getting error 'ngx-datatable-column' is not a known element. I have already tried solutions like importing NgxDatatableModule into child component instead of appModule or restarting system after installation. It's still there. I am using all latest versions:

"@angular/core": "8.2.6", "@swimlane/ngx-datatable": "^16.0.3", NVM Node: 12.16.1

app.module.ts :

import { NgxDatatableModule } from '@swimlane/ngx-datatable';

@NgModule({
  declarations: [
    AppComponent,
    LandingComponent
  ],
  imports: [
    BrowserAnimationsModule,
    BrowserModule,
    [NgxDatatableModule],
    RouterModule.forRoot(routes, {useHash: true}),
    SiLandingPageModule,
    SharedModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    })
  ],
  exports: [RouterModule],
  bootstrap: [AppComponent]
})

Component file is exactly like given here : https://github.com/swimlane/ngx-datatable/blob/master/src/app/basic/inline.component.ts

In your imports section in app.module.ts change the below:

From: [NgxDatatableModule]

To: NgxDatatableModule

Not sure why but downgrading Node to 12.15.0 did the trick. The error went off!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM