0
我正在使用这个包:https://github.com/troyanskiy/ng2-resource-rest,但我不知道如何正确导入我的功能模块。 Doc说:如何在功能模块中使用导入forRoot()的服务?
@NgModule({
imports: [
BrowserModule,
ResourceModule.forRoot()
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule {
}
好的。我怎样才能从我的功能模块中使用它?我有一个核心模块和一个共享模块。我有一个MyResource
类从这个包扩展Resource
类。当我尝试在功能模块中注入并使用MyResource
时,角度为No provider for MyResource
。如果我将MyResource
添加到功能模块提供程序中,则表示Resource
类中的http
未定义。