【发布时间】:2017-08-03 19:55:58
【问题描述】:
我正在尝试将我的 ngrx/Store 声明到规范文件中以测试容器组件。所以我首先导入商店,然后在 beforeEach 中执行以下操作:
import {Store} from '@ngrx/store';
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [NotificationsComponent, NotificationsDevicesComponent,
ToArrayPipe, OrderByDate, TimezoneFormatPipe],
providers: [{ provide: Store, useClass: Store }]
})
.compileComponents().then(() => {
fixture = TestBed.createComponent(NotificationsComponent);
component = fixture.componentInstance;
el = fixture.debugElement;
fixture.detectChanges();
});
}));
但我从标题中得到错误,无法解析 Store 的所有参数:(?, ?, ?)。
有什么想法吗?
非常感谢
【问题讨论】:
-
cannot resolve parameters for foo: (?, ?)通常意味着您的依赖注入无法正常工作(循环依赖、错误导入、错误导出等)。问号将指示依赖关系。有时它会像(FooService, BarService, ?),这意味着第三个依赖是有问题的。 -
尝试将您尝试注入的 3 项服务直接从他们的文件中导入
Store,而不是从桶中,如果您正在这样做的话。
标签: angular ngrx ngrx-store