I tried to import the http provider into a service, but I\'m getting the following error:
Cannot resolve all parameters for \'AppService\'(?). Make su
Seems like you are not using typescript compiler for transpiling files to js, In that case you need to have use @Inject while injecting any dependency inside a component constructor.
import {Injectable, Inject} from 'angular2/core';
import {Http, Response} from 'angular2/http';
import {Observable} from 'rxjs/Rx';
@Injectable()
export class AppService {
constructor(@Inject(Http) private http: Http) { }
// Uses http.get() to load a single JSON file
getTableData() {
return this.http.get('...').map((res: Response) => res.json());
}
}