首页 > 解决方案 > 未处理的承诺拒绝:[object Object] 没有提供者!; 区:; 任务:Promise.then;值:错误:[object Object] 没有提供者!

问题描述

我正在尝试将ngrx 效果添加到我的角度应用程序中。

我做了这样的效果->

import { HttpService } from './../../../shared/services/common/http.service';
import { Injectable, Inject } from '@angular/core';
import * as ItemsListActions from './itemsList.actions';

@Injectable()
export class ItemsListEffects {
  // Listen for the 'LOGIN' action
  constructor(@Inject(HttpService) private _http: HttpService, @Inject(ItemsListActions) private _actions$: ItemsListActions) {}
}

我删除了内容导致错误始终出现

在 appModule 我有

    @NgModule({
        imports: [
            EffectsModule.forRoot([ItemsListEffects]),
        ]
    })

但是当我编译时我有

Unhandled Promise rejection: No provider for [object Object]! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for [object Object]!

如果我评论导入,没有错误。

但我不明白我的错误

标签: angularngrx

解决方案


似乎@Inject模块不提供构造函数中的 'ed 属性。


推荐阅读