我尝试将自己的自定义模块导入到应用模块中,但我一直收到此错误。
"Uncaught Error: Unexpected value 'ActionsService' imported by the module 'ReduxStoreModule'. Please add a @NgModule annotation."
它要我添加@NgModule注释,但我的两个模块中都有@NgModule。我不知道自己做错了什么。请帮忙。
app.module.ts
import { BrowserModule } from '@angular/platform-browser'
import { NgModule } from '@angular/core'
import { AppComponent } from './app.component'
import { ReduxStoreModule } from './Redux-Store/redux-store.module'
@NgModule( {
declarations: [ AppComponent ],
imports: [
BrowserModule
,ReduxStoreModule
],
providers: [],
bootstrap: [ AppComponent ]
} )
export class AppModule { }
终极版-store.module.ts
import { CommonModule } from '@angular/common'
import { NgReduxModule } from '@angular-redux/store'
import { NgModule } from '@angular/core'
import { ActionsService } from './actions'
const ImportsExports = [
ActionsService
,NgReduxModule
]
@NgModule( {
imports: ImportsExports
,exports: ImportsExports
} )
export class ReduxStoreModule { }
答案 0 :(得分:1)
服务应位于不在模块下的提供商下,从模块中删除 ActionsService
并将其添加到提供商下,
const ImportsExports = [
NgReduxModule
]