0
votes

When I try to implement ng2-smarttable in my project it gives the following error:

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/lib.js Failed to load resource: the server responded with a status of 404 (Not Found)

This is also for the following files:

localhost/:56 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/lib.js(…) "Report this error at https://github.com/mgechev/angular2-seed/issues"(anonymous function) @ (index):56

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.html.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.html.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/filter/filter.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/cell/cell.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/pager/pager.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

http://localhost:5555/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/title/title.scss.js Failed to load resource: the server responded with a status of 404 (Not Found)

I installed ng2-smart-table by doing npm install --save ng2-smart-table and after that, just to make sure (and probably unnecessary) also npm install.

I did the following in my module:

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { BrowserModule } from '@angular/platform-browser';

import { Ng2SmartTableModule } from 'ng2-smart-table';

import { SmartTableComponent } from './smart-table.component';

@NgModule({
    imports: [
        RouterModule,
        BrowserModule,
        Ng2SmartTableModule
    ],
    declarations: [SmartTableComponent],
    exports: [SmartTableComponent],
})

export class SmartTableModule { }

And then in the component I put the necessary standard operation as instructed by the tutorial: https://akveo.github.io/ng2-smart-table/demo. So I did:

import { Component, OnInit } from '@angular/core';

import { SensorData } from '../tables/sensor-data';
import { SensorDataService } from '../tables/sensor-data.service';

import { LocalDataSource } from 'ng2-smart-table';

// webpack html imports

@Component({
    moduleId: module.id,
    selector: 'smart-table',
    templateUrl: 'smart-table.component.html'
})

export class SmartTableComponent {

    settings = {
        columns: {
            SendDate: {
                title: 'Send Date'
            },
            Key: {
                title: 'Key'
            },
            Value: {
                title: 'Value'
            },
            SensorId: {
                title: 'Sensor #Id'
            }
        }
    };

    source: LocalDataSource;

    public constructor(private sensorDataService: SensorDataService) {
        this.source = new LocalDataSource();

        this.sensorDataService.getSensorData(2)
            .subscribe(
            data => {
                this.source.load(data);
                console.log(this.source);
            },
            error => console.log(<any>error));
    }

}

I notice it tries to get .js? I don't understand how I can fix this problem as I did everything the way it should.

Any help would be much appreciated!

1

1 Answers

0
votes

My project has a systemjs.config.js file which maps and controls all my packages.

See below for an example:

var packages = {
    'angular2-highcharts': {main: 'index.js', defaultExtension: 'js' }
};

This defaultExtension could be what is holding you back.