How to use the @ngrx/store.StoreModule.forFeature function in @ngrx/store

To help you get started, we’ve selected a few @ngrx/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anihalaney / rwa-trivia / src / app / user / user.module.ts View on Github external
ProfileCardComponent,
    UserStatsCardComponent,
    GameCardComponent,
    GameInviteComponent,
    RecentGamesComponent,
    ProfileSettingsComponent,
    MyQuestionsComponent,
    QuestionAddUpdateComponent
  ],
  imports: [
    // rwa modules
    SharedModule,
    UserRoutingModule,

    //ngrx feature store
    StoreModule.forFeature('user', reducer),

    //ngrx effects
    EffectsModule.forFeature(effects),

  ],
  providers: [],
  exports: [
    ProfileCardComponent,
    UserStatsCardComponent,
    GameCardComponent,
    GameInviteComponent,
    RecentGamesComponent,
    ProfileSettingsComponent,
    MyQuestionsComponent,
    QuestionAddUpdateComponent
  ]
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / cart / store / effects / cart.effect.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        HttpClientTestingModule,
        StoreModule.forRoot({}),
        StoreModule.forFeature('cart', fromCart.getReducers()),
        StoreModule.forFeature('user', fromUser.getReducers()),
        StoreModule.forFeature('auth', fromAuth.getReducers()),
      ],

      providers: [
        OccCartService,
        ProductImageNormalizer,
        fromEffects.CartEffects,
        { provide: OccConfig, useValue: MockOccModuleConfig },
        CartService,
        CartDataService,
        provideMockActions(() => actions$),
      ],
    });

    cartEffects = TestBed.get(fromEffects.CartEffects);
    cartService = TestBed.get(OccCartService);
github SAP / cloud-commerce-spartacus-storefront / projects / storefrontlib / src / lib / ui / layout / product-list-page-layout / product-list-page-layout.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        ProductListModule,
        StoreModule.forRoot({}),
        StoreModule.forFeature('products', fromProduct.getReducers()),
        StoreModule.forFeature('cart', fromCart.getReducers()),
        StoreModule.forFeature('user', fromUser.getReducers())
      ],
      providers: [ProductSearchService],
      declarations: [ProductListPageLayoutComponent]
    }).compileComponents();
  }));
github nrwl / nx-examples / libs / model / src / lib / model.module.ts View on Github external
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { appReducer } from './+state/app.reducer';
import { appInitialState } from './+state/app.init';
import { AppEffects } from './+state/app.effects';

@NgModule({
  imports: [
    CommonModule,
    StoreModule.forFeature('app', appReducer, { initialState: appInitialState }),
    EffectsModule.forFeature([AppEffects])
  ],
  providers: [AppEffects]
})
export class ModelModule {}
github Farata / angulartypescript / code-samples / chapter15 / ng-auction / client / src / app / home / home.module.ts View on Github external
children: [
      { path: '', pathMatch: 'full', redirectTo: 'all' },
      { path: ':category', component: CategoriesComponent }
    ]
  }
];

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(routes),
    FlexLayoutModule,
    MatGridListModule,
    MatTabsModule,

    StoreModule.forFeature('homePage', reducers),
    EffectsModule.forFeature([ CategoriesEffects, ProductsEffects ])
  ],
  declarations: [
    CategoriesComponent,
    ProductGridComponent,
    SearchComponent
  ]
})
export class HomeModule {
}
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / checkout / store / selectors / checkout.selectors.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        StoreModule.forRoot({}),
        StoreModule.forFeature(CHECKOUT_FEATURE, fromReducers.getReducers()),
      ],
    });

    store = TestBed.get(Store as Type>);
    spyOn(store, 'dispatch').and.callThrough();
  });
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / cart / facade / cart-voucher.service.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        StoreModule.forRoot({}),
        StoreModule.forFeature('cart', fromReducers.getReducers()),
        StoreModule.forFeature(
          PROCESS_FEATURE,
          fromProcessReducers.getReducers()
        ),
      ],
      providers: [
        CartVoucherService,
        { provide: AuthService, useClass: AuthServiceStub },
      ],
    });

    service = TestBed.get(CartVoucherService as Type);
    store = TestBed.get(Store as Type>);

    store.dispatch(new DeprecatedCartActions.CreateCartSuccess(cart));
  });
github bwsw / cloudstack-ui / src / app / vm / vm.module.ts View on Github external
MaterialModule,
    DynamicModule.withComponents([VmListCardItemComponent]),
    DynamicModule.withComponents([VmListRowItemComponent]),
    DraggableSelectModule,
    ClipboardModule,
    PulseModule,
    MatExpansionModule,
    RouterModule,
    ServiceOfferingModule,
    SnapshotModule,
    TagsModule,
    TemplateModule,
    TranslateModule,
    ResourceQuotasModule,
    VmLogsModule,
    StoreModule.forFeature('virtualMachines', virtualMachineReducers),
    StoreModule.forFeature('accounts', accountReducers),
    StoreModule.forFeature('tags', accountTagsReducers),
    StoreModule.forFeature('zones', zoneReducers),
    StoreModule.forFeature('service-offerings', serviceOfferingReducers),
    EffectsModule.forFeature([
      VirtualMachinesEffects,
      VirtualMachineCreationEffects,
      ZonesEffects,
      AccountsEffects,
      AccountTagsEffects,
      ServiceOfferingEffects,
    ]),
  ],
  declarations: [
    AffinityGroupComponent,
    AffinityGroupSelectorComponent,
github graycoreio / daffodil / libs / cart / src / cart-state.module.ts View on Github external
import { NgModule } from '@angular/core';

import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';

import { reducers } from './reducers/index';
import { DaffCartEffects } from './effects/cart.effects';

@NgModule({
  imports: [
    StoreModule.forFeature('cart', reducers),
    EffectsModule.forFeature([
      DaffCartEffects
    ]),
  ]
})
export class DaffCartStateModule { }
github ffxiv-teamcraft / ffxiv-teamcraft / apps / client / src / app / modules / rotations / rotations.module.ts View on Github external
import { RotationPickerDrawerComponent } from './rotation-picker-drawer/rotation-picker-drawer.component';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { FlexLayoutModule } from '@angular/flex-layout';

@NgModule({
  imports: [
    CommonModule,
    CoreModule,
    FormsModule,
    TranslateModule,
    NgZorroAntdModule,
    RouterModule,
    FlexLayoutModule,

    StoreModule.forFeature('rotations', rotationsReducer, {
      initialState: rotationsInitialState
    }),
    EffectsModule.forFeature([RotationsEffects])
  ],
  declarations: [RotationPickerDrawerComponent],
  entryComponents: [RotationPickerDrawerComponent],
  providers: [RotationsFacade]
})
export class RotationsModule {
}