404 error
import {NG_TABLE_DIRECTIVES} from 'ng2-table';


I installed with npm, and there is no compilation error but chrome console gives these error message and ng2-table won't load. Please help, thanks!
try doing ng2-table/ng2-table
this is how i have done it so far and it seems to be working, this also depends on how its installed.
you could also try
node_modules/ng2-table/ng2-table
i am using the angular/angular2-seed setup and i only had to use ng2-table/ng2-table.
Same problem here.
import {NG_TABLE_DIRECTIVES} from 'node_modules/ng2-table/ng2-table'; gives me an error in my editor (Atom): "Cannot find module 'node_modules/ng2-table/ng2-table'."
and import {NG_TABLE_DIRECTIVES} from 'ng2-table/ng2-table'; gives me this error in the browser: GET http://localhost:4200/ng2-table/ng2-table 404 (Not Found)
Are you using systemjs? I've not seen this error so far with my testing but i have everything being bundled up by webpack.
How do I tell? It's in node_modules, but I don't think I'm using it. Maybe?
What does your index.html look like? This would give an easy way to check into it.
Can you paste it in either a gist or directly on this issue wrapped in code tags so that we can see teh contents, github stripped the HTML out.
<html><head><meta charset="utf-8"><title>MyApp</title><base href="/">{{content-for 'head'}}<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="bootstrap.css" rel="stylesheet"><link href="/css/theme.min.css" rel="stylesheet"><link href="/css/myapp.css" rel="stylesheet"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"></head><body><myapp></myapp>
<script src="vendor/es6-shim/es6-shim.js"></script><script src="vendor/systemjs/dist/system-polyfills.js"></script><script src="vendor/angular2/bundles/angular2-polyfills.js"></script><script src="vendor/systemjs/dist/system.src.js"></script><script src="vendor/rxjs/bundles/Rx.js"></script>
<script src="jquery.js"></script><script src="bootstrap.js"></script><script src="ng2-bootstrap.js"></script>
<script src="vendor/angular2/bundles/angular2.dev.js"></script><script src="vendor/angular2/bundles/http.dev.js"></script><script src="vendor/angular2/bundles/router.dev.js"></script>
<script>System.config({packages: {app: {format: 'register',defaultExtension: 'js'},moment: {main: 'moment.js',type: 'cjs',defaultExtension: 'js'}}});System.import('app.js').then(null, console.error.bind(console));</script></body></html>
import {PAGINATION_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; is working, for reference
So this issue comes from the fact that system.js does not know how to look up ng2-table.
This might help you get started on that front, in your code change the section that says "System.config" everything in side that script tag to this:
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
moment: {
main: 'moment.js',
type: 'cjs',
defaultExtension: 'js'
}
},
map: {
'ng2-table': 'node_modules/ng2-table'
}
});
hopefully this helps you get your app running, if not, i highly suggest using a starter pack such as angular/angular2-seed and using its webpack server to compile everything during development to make life a little bit simpler.
Aghh. I really thought that would do it...
Shouldn't it be looking there by default though? It finds ng2-bootstrap ok... I don't think a nuclear option is necessary, but anyway, I can't start over
Any other ideas?
This seems to be late but you need to add a mapping like,
'ng2-table': 'vendor/ng2-table' // ng2-table mapping
and add
// ng2-table dependency cliSystemConfigPackages['ng2-table'] = { main: 'ng2-table' };
to your package list.
Also, add
'ng2-table/**/*.js' // ng2-table in dist
in your build file
just extending Destreyf's comment. should add 'ng2-table':{ defaultExtension: 'js' } under packages section in systemjs.config.js
I am getting this error: GET http://localhost:1337/node_modules/ng2-table/components/table/ng-table.component 404 (Not Found)
my system js has under map 'ng2-table/ng2-table' : 'node_modules/ng2-table/ng2-table.js' under packages: 'ng2-table': {defaultExtension: 'js'}
I am getting the same error as Icborn4. GET http://localhost:58933/node_modules/ng2-table/components/table/ng-table.component 404 (Not Found). But this is not the only file that can not be found. Actually all the required files in ng2-table.js can not be found.
I have installed ng2-table using npm. And this is what my configuration js filecontains: under map: ng2-table/ng2-table': 'node_modules/ng2-table/ng2-table.js' under packages: 'ng2-table': { defaultExtension: 'js' }
Thank you in advance
Hi,
I started my project with the ng2 quick start seed, so I'm using SystemJS.
I did this way in System.config:
... paths: { 'npm:': '../node_modules/' }, map: { 'ng2-table': 'npm:ng2-table' }, packages: { 'ng2-table': { defaultExtension: 'js' } } ... In my application module:
... import { Ng2TableModule } from 'ng2-table/ng2-table'; ...
And finally, 404 errors disapeared.
I hope these can help you.
Hi Paula,
Thank you. That fixed my problems.
Thanks, Paula your reply kind of helped me too. I had to do the following
-
In package.json ... "dependencies": { .... "ng2-table": "1.3.2"
-
In Systemjs.config.js map: { .... 'ng2-table': 'node_modules/ng2-table' } packages: { .... , 'ng2-table': {defaultExtension: 'js' } }
-
in my app.module.ts
import { Ng2TableModule } from 'ng2-table/ng2-table';
... @NgModule({ imports: [BrowserModule,.... , Ng2TableModule], .... })
- Then in my template <ng-table [config]="config" .... >
Got the ng2-table working in angular 4 environment, finally,
Also I have a gulpfile.js to do the copying...