From what I see, you should provide $WebSocket by injection, as you create it yourself for your service. I would remove it from bootstrap and create an instance in the constructor instead of providing it from the constructor options:
@Injectable() export class ConnectionService { private _status: number; private connection: $WebSocket; constructor() { this.connection = new $WebSocket("ws://echo.websocket.org"); } }
In general, if you want to use dependency injection in Angular, you must let Angular2 create the things you want in the constructor yourself.
In your case, Angular2 tries to create an instance of the $WebSocket service. I think its constructor accepts three parameters and when Angular2 tries to resolve these parameters at the instance level. He cannot solve the latter. Could you provide the $WebService constructor options?
source share