...
import {$WebSocket} from "angular2-websocket/angular2-websocket";
@Injectable()
export class DeviceService {
private logger:Logger;
private ws:$WebSocket;
constructor(
private _logger: Logger
) {
this.logger=_logger;
this.ws = new $WebSocket("ws://nodered-iot.net/ws/devices");
}
private _devices:Device[] = [];
getDevices() {
this.ws.send("Hello");
...
On my browser I get this :
GET http://localhost:1880/node_modules/angular2-websocket/angular2-websocket 404 (Not Found)I @ system.src.js:4597(anonymous function) http://localhost:1880/node_modules/angular2-websocket/angular2-websocket(…)
I use this definition on index.html
<!-- 2. Configure SystemJS -->
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true },
packages: {'app': {defaultExtension: 'ts'}},
map: {
'angular2-websocket': 'node_modules/angular2-websocket'
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
****** EDIT *******
i successfully found the FIX as it :
System.config({ transpiler: 'typescript', typescriptOptions: { emitDecoratorMetadata: true }, packages: { 'app': {defaultExtension: 'ts'}, 'js': { defaultExtension: 'ts' }}, map: { 'angular2-websocket': 'js' } }); System.import('app/main') .then(null, console.error.bind(console));I had to copy files from node_module into a new js folder. This is not very nice but I don't know how to make this available on client side if these files are not on the 'public' folder of nodeJs :/