【发布时间】:2016-02-15 13:44:56
【问题描述】:
我正在尝试在 Redux 的帮助下消除组件对 Angular 服务的依赖。
基本上,流程是Component -> Action -> Service
服务中我要使用@angular/core的http模块,建议在构造函数中传入:
export class SampleService {
constructor(public http: Http) {}
}
当我从操作中调用服务时,它不会获取 http 提供程序,因为我没有 http 提供程序的实例。
export default class SampleAction {
private _projectService;
constructor() {
this._sampleService = new SampleService();
}
}
如何将 http 提供程序注入到服务中?
【问题讨论】:
标签: angular redux angular2-services injectableprovider