angular-2-data-table icon indicating copy to clipboard operation
angular-2-data-table copied to clipboard

ERROR in DataTableModule is not an NgModule

Open harshapuli opened this issue 9 years ago • 16 comments

Data Table is not an ngModule

harshapuli avatar Jan 19 '17 19:01 harshapuli

+1

diegoa1989 avatar Jan 26 '17 19:01 diegoa1989

+1

EdsonGustavoTofolo avatar Jan 27 '17 18:01 EdsonGustavoTofolo

+1

az-9 avatar Feb 16 '17 12:02 az-9

has someone fixed this problem already?

ghost avatar Feb 16 '17 16:02 ghost

+1

chsunil avatar Feb 25 '17 05:02 chsunil

Anyone ever get to the bottom of this?

jaredthigpen avatar Apr 23 '17 12:04 jaredthigpen

Same issue for me, I'm using angular 4 and angular/cli 1.1.2

marcioprog avatar Jun 20 '17 22:06 marcioprog

+1

AshwinDeva avatar Jun 21 '17 12:06 AshwinDeva

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?

mehtasagar avatar Jun 21 '17 19:06 mehtasagar

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 { }

AshwinDeva avatar Jul 06 '17 12:07 AshwinDeva

Fix it the with the above lines and release some new package...

AshwinDeva avatar Jul 06 '17 12:07 AshwinDeva

Thanks AshwinDeva. Currently using Angular 4.3.0. Is it possible to update the main package for this workaround ?

real050280 avatar Jul 19 '17 09:07 real050280

@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

Stefan-Z-Camilleri avatar Jul 26 '17 15:07 Stefan-Z-Camilleri

Just replace in app.module.ts: import { DataTableModule } from 'angular-4-data-table'; with import { DataTableModule } from 'angular-4-data-table/src/index';

okpablo avatar Jan 10 '18 20:01 okpablo

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

jdtstudios avatar Jan 23 '18 04:01 jdtstudios

@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.

malabmon avatar Nov 08 '19 12:11 malabmon