ERROR in DataTableModule is not an NgModule
Data Table is not an ngModule
+1
+1
+1
has someone fixed this problem already?
+1
Anyone ever get to the bottom of this?
Same issue for me, I'm using angular 4 and angular/cli 1.1.2
+1
I'm using angular 4 and angular/cli 1.0.0 ...Did anyone found any solution for these. The error goes if i save any file again when ng serve is running?
As a workaround, in index.d.ts file of angular-2-data-table, add the below lines ,
import { NgModule } from 'angular/core'; @NgModule({}) export declare class DataTableModule { }
Fix it the with the above lines and release some new package...
Thanks AshwinDeva. Currently using Angular 4.3.0. Is it possible to update the main package for this workaround ?
@AshwinDeva your workaround seems good, yet it would only ever work on your pc, and not that of other devs.
I'm not sure about this, since I don't have an env to test on, but maybe you can try the following instead:
import { NgModule } from 'angular/core';
import { DataTableModule } from '...wherever...';
// TODO: Hack due to https://github.com/ggmod/angular-2-data-table/issues/10
@NgModule({})
export declare class Ng4DataTableModule extends DataTableModule {
}
..and just import Ng4DataTableModule
Just replace in app.module.ts:
import { DataTableModule } from 'angular-4-data-table';
with
import { DataTableModule } from 'angular-4-data-table/src/index';
Was having the same issue use AshwinDeva fix but with a slight change: in index.d.ts file of angular-2-data-table: replaced export declare class DataTableModule { } with: import { NgModule } from '@angular/ core'; @NgModule({}) export declare class DataTableModule { } and is my app.modules.ts changed: import {DataTableModule} from 'angular-2-data-table'; to: import {DataTableModule} from 'angular-2-data-table/dist';
Thanks AshwinDeva
@mehtasagar @marcioprog I also faced the same error with angular 4. I resolved it by removing node_module folder then without sudo I run npm i then I get an error related to node-sass. This solved by npm install node-sass without sudo. If it not worked, redownload your git project if any and try again with above steps.