I am in the process of transitioning from Webpack to JSPM with system.js. Our application has a simple App component. I have been following the steps outlined in this article Angular 2 Starter Setup with JSPM, SystemJS and Typescript in atom (Part 1)
import {Component} from 'angular2/core';
import {Bus} from './business.service';
@Component({
selector: 'app',
template: `
<p>Hello World</p>
`,
providers:[Bus]
})
export class App {
constructor(private bus : Bus) { }
}
We also have a simple business service using Http
import {Injectable} from 'angular2/core';
import {Http, Response, Headers, RequestOptions} from 'angular2/http';
import {Observable} from 'rxjs/Observable';
@Injectable()
export class Bus {
constructor(private http: Http){
}
}
Everything was working fine with Webpack, but after switching to systemjs, I started getting the following error:
EXCEPTION: No provider for Http! (App -> Bus -> Http)
I came across a similar issue on StackOverflow here, but it seemed to be related to Angular2 alpha versions whereas we are using beta@7
I also experimented with the code snippet below:
import {Component} from 'angular2/core';
//import {Bus} from './business.service';
import {Http, Response, Headers, RequestOptions} from 'angular2/http';
@Component({
selector: 'app',
template: `
<p>Hello World</p>
`,
providers:[Http]
})
export class App {
constructor(private bus : Http) { }
}
However, the error message became even more confusing:
EXCEPTION: No provider for ConnectionBackend! (App -> Http -> ConnectionBackend)
I even attempted downgrading to angular2-beta@6 and angular2-beta@1. Can you help me identify what I might be doing wrong? Thank you.
Using loader versions:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b1812181f0e0601182b5b455a52455958">[email protected]</a>