Angular2 rc.5如何注入HTTP_PROVIDERS,现在所有都是模块...
var injector = ReflectiveInjector.resolveAndCreate(
[
TodoService,
TodoAction,
HTTP_PROVIDERS, // <----- no longer injectable
TodoStatsModel,
{provide: CommBroker, useClass: CommBroker},
{provide: AppStore, useValue: th[![i][1]][1]s.appStore}
]);
的问候,
肖恩
答案 0 :(得分:4)
对于RC5,您必须在HttpModule
imports array
内添加@NgModule
以获取更多详情,请查看此link
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
@NgModule({
imports: [BrowserModule, HttpModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}