本文整理匯總了TypeScript中@ngrx/effects.EffectsModule.forFeature方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript EffectsModule.forFeature方法的具體用法?TypeScript EffectsModule.forFeature怎麽用?TypeScript EffectsModule.forFeature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ngrx/effects.EffectsModule
的用法示例。
在下文中一共展示了EffectsModule.forFeature方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: platformBrowserDynamicTesting
const testModuleConfig = () => {
TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting())
.configureTestingModule({
imports: [
RouterTestingModule,
StoreModule.forFeature('i18n', reducers),
EffectsModule.forFeature([LanguageEffects]),
CoreModule.forRoot([
{
provide: ConfigLoader,
useFactory: configFactory,
deps: [
PLATFORM_ID,
HttpClient
]
}
]),
CoreTestingModule,
NgrxTestingModule,
AnalyticsModule,
I18NTestingModule
],
providers: [
LanguageEffects
]
});
};
示例2: beforeEach
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
RouterTestingModule,
HttpModule,
NoopAnimationsModule,
DataListModule,
StoreModule.forRoot(reducers),
StoreRouterConnectingModule.forRoot({
stateKey: 'router'
}),
EffectsModule.forRoot([RoutingEffects]),
StoreModule.forFeature('users', usersReducer),
EffectsModule.forFeature([UserEffects])
],
providers: [ LoggerService,
{ provide: ActivatedRoute, useClass: ActivatedRouteStub },
{ provide: UserService, useValue: spyUserService },
{ provide: LoginService, useClass: LoginServiceStub },
{ provide: API_BASE_URL, useValue: '/api' },
UserActions,
UserResolver,
],
declarations: [UserListComponent]
});
// Create component
fixture = TestBed.createComponent(UserListComponent);
comp = fixture.componentInstance;
// Get BackendService actually injected into the component
// userService = TestBed.get(UserService);
userService = fixture.debugElement.injector.get(UserService);
// Setup spy on the `getQuote` method
// spy1 = spyOn(userService, 'findAllUsers').and.returnValue(Observable.of(testUsers));
// Get the tested element by CSS selector (e.g., by class name)
de = fixture.debugElement.query(By.css('ul'));
el = de.nativeElement;
});