@ngrx/effects#EffectsModule TypeScript Examples
The following examples show how to use
@ngrx/effects#EffectsModule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: app.module.ts From nica-os with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent,
...components,
...directives,
...pipes
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
FontAwesomeModule,
CommonsModule,
StoreModule.forRoot({app: appReducer, fs: fileExplorerReducer}),
EffectsModule.forRoot([AppEffects]),
StoreDevtoolsModule.instrument({maxAge: 25, logOnly: environment.production})
],
providers: [...services],
bootstrap: [AppComponent]
})
export class AppModule {}
Example #2
Source File: dashboard.component.spec.ts From barista with Apache License 2.0 | 6 votes |
// tslint:enable:max-line-length
describe('DashboardComponent', () => {
let component: DashboardComponent;
let fixture: ComponentFixture<DashboardComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DashboardComponent, ProjectsComponent, ProjectStatusNormalComponent, ModuleSearchComponent],
imports: [
NoopAnimationsModule,
RouterTestingModule,
StoreModule.forRoot({}),
EffectsModule.forRoot([]),
EntityDataModule.forRoot(entityConfig),
EntityStoreModule,
HttpClientTestingModule,
LayoutModule,
NgxDatatableModule,
AppMaterialModule,
AppComponentsModule,
],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should compile', () => {
expect(component).toBeTruthy();
});
});
Example #3
Source File: app.module.ts From Angular-Cookbook with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent,
HomeComponent,
AppFooterComponent,
UserCardComponent,
LoaderComponent,
UserDetailComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
StoreModule.forRoot({ app: appStore.reducer, router: routerReducer }),
StoreRouterConnectingModule.forRoot(),
StoreDevtoolsModule.instrument({
maxAge: 25, // Retains last 25 states
}),
EffectsModule.forRoot([AppEffects]),
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Example #4
Source File: core.module.ts From svvs with MIT License | 6 votes |
@NgModule({
declarations: [...coreContainers],
imports: [
NxModule.forRoot(),
RootStoreModule,
StorageModule.forRoot(),
AuthModule,
EffectsModule.forRoot([]),
RouterModule.forRoot(coreRoutes, {
initialNavigation: 'enabled',
scrollPositionRestoration: 'enabled',
}),
],
providers: [
{
provide: APOLLO_OPTIONS,
useFactory: createApollo,
deps: [HttpLink],
}],
})
export class CoreModule {
}
Example #5
Source File: auth.module.ts From router with MIT License | 6 votes |
@NgModule({
imports: [
CommonModule,
ReactiveFormsModule,
MaterialModule,
StoreModule.forFeature(fromAuth.authFeatureKey, fromAuth.reducers),
EffectsModule.forFeature([AuthEffects]),
],
declarations: COMPONENTS,
exports: COMPONENTS,
})
export class AuthModule {}
Example #6
Source File: members-store.module.ts From dating-client with MIT License | 6 votes |
@NgModule({
imports: [
StoreModule.forFeature(
fromMembers.membersFeatureKey,
fromMembers.reducer
),
EffectsModule.forFeature([
MembersEffects,
MemberEffects,
])
],
})
export class MembersStoreModule {}
Example #7
Source File: app.component.spec.ts From geonetwork-ui with GNU General Public License v2.0 | 6 votes |
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule,
EffectsModule.forRoot(),
StoreModule.forRoot({}),
],
declarations: [AppComponent],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents()
})
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app).toBeTruthy()
})
})
Example #8
Source File: app.module.ts From ngrx-issue-tracker with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent,
IssuesComponent,
NewIssueComponent,
IssueListComponent,
IssueDetailComponent,
LoaderComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
HttpClientModule,
StoreModule.forRoot(reducers, { metaReducers }),
EffectsModule.forRoot([HydrationEffects, RouterEffects]),
StoreRouterConnectingModule.forRoot({ routerState: RouterStateMinimal }),
EntityDataModule.forRoot(entityConfig),
modules,
InMemoryWebApiModule.forRoot(DatabaseService),
],
providers: [
{ provide: DefaultDataServiceConfig, useValue: defaultDataServiceConfig },
],
bootstrap: [AppComponent],
})
export class AppModule {}
Example #9
Source File: role.module.ts From digital-bank-ui with Mozilla Public License 2.0 | 6 votes |
@NgModule({
imports: [
CommonModule,
RoleRoutingModule,
NbButtonModule,
NbCardModule,
NbLayoutModule,
NbInputModule,
NbCheckboxModule,
NbTreeGridModule,
NbListModule,
Ng2SmartTableModule,
NbSelectModule,
NbIconModule,
SharedModule,
NbEvaIconsModule,
FormsModule,
ReactiveFormsModule,
/**
* Define feature state
*/
StoreModule.forFeature(fromRoles.roleFeatureKey, fromRoles.reducers),
EffectsModule.forFeature([RoleApiEffects, RoleRouteEffects, RoleNotificationEffects]),
],
declarations: [
RoleDetailComponent,
RoleComponent,
RoleFormComponent,
FsIconComponent,
RoleCreateComponent,
RoleEditComponent,
PermissionListItemComponent,
],
providers: [RoleExistsGuard, FormPermissionService],
entryComponents: [],
})
export class RoleModule {}
Example #10
Source File: app.module.ts From youpez-admin with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
FlexLayoutModule,
CoreModule,
HttpClientModule,
SharedModule,
StoreModule.forRoot(reducers, {metaReducers}),
!environment.production ? StoreDevtoolsModule.instrument() : [],
EffectsModule.forRoot([AppEffects]),
NgxMdModule.forRoot(),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
Example #11
Source File: authentication.module.ts From spurtcommerce with BSD 3-Clause "New" or "Revised" License | 6 votes |
@NgModule({
imports: [
CommonModule,
AuthRoutingModule,
NgbModule,
ReactiveFormsModule,
FormsModule,
ToastrModule.forRoot(),
EffectsModule.forRoot([AuthEffects])
],
declarations: [LoginComponent, ForgotPasswordComponent],
providers: [AuthService, AuthSandbox]
})
export class AuthenticationModule {}
Example #12
Source File: current-user.module.ts From taiga-front-next with GNU Affero General Public License v3.0 | 6 votes |
@NgModule({
declarations: [],
imports: [
CurrentUserApiModule,
StoreModule.forFeature(fromCurrentUser.currentUserFeatureKey, fromCurrentUser.reducer),
EffectsModule.forFeature([CurrentUserEffects]),
],
})
export class CurrentUserModule { }
Example #13
Source File: app.component.spec.ts From barista with Apache License 2.0 | 5 votes |
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
AppMaterialModule,
HttpClientModule,
AppComponentsModule,
StoreModule.forRoot({}),
EffectsModule.forRoot([]),
EntityDataModule.forRoot(entityConfig),
EntityStoreModule,
HttpClientTestingModule,
LayoutModule,
],
declarations: [AppComponent, HeaderComponent, FooterComponent, SideNavComponent],
providers: [
NavService,
{
provide: AuthService,
useValue: {
userInfo: jest.fn().mockReturnValueOnce({ role: 'Admin' }),
},
},
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'barista-web'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('barista-web');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1 span').textContent).toContain('Barista');
});
});
Example #14
Source File: app.module.ts From router with MIT License | 5 votes |
@NgModule({
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
/**
* StoreModule.forRoot is imported once in the root module, accepting a reducer
* function or object map of reducer functions. If passed an object of
* reducers, combineReducers will be run creating your application
* meta-reducer. This returns all providers for an @ngrx/store
* based application.
*/
StoreModule.forRoot(ROOT_REDUCERS, {
metaReducers,
runtimeChecks: {
// strictStateImmutability and strictActionImmutability are enabled by default
strictStateSerializability: true,
strictActionSerializability: true,
strictActionWithinNgZone: true,
strictActionTypeUniqueness: true,
},
}),
/**
* @ngrx/router-store keeps router state up-to-date in the store.
*/
// StoreRouterConnectingModule.forRoot(),
/**
* Store devtools instrument the store retaining past versions of state
* and recalculating new states. This enables powerful time-travel
* debugging.
*
* To use the debugger, install the Redux Devtools extension for either
* Chrome or Firefox
*
* See: https://github.com/zalmoxisus/redux-devtools-extension
*/
StoreDevtoolsModule.instrument({
name: 'NgRx Book Store App',
// In a production build you would want to disable the Store Devtools
// logOnly: environment.production,
}),
/**
* EffectsModule.forRoot() is imported once in the root module and
* sets up the effects class to be initialized immediately when the
* application starts.
*
* See: https://ngrx.io/guide/effects#registering-root-effects
*/
EffectsModule.forRoot([UserEffects]),
CoreModule,
],
bootstrap: [AppComponent],
providers: [provideComponentRouter()],
})
export class AppModule {}
Example #15
Source File: webcomponents.module.ts From geonetwork-ui with GNU General Public License v2.0 | 5 votes |
@NgModule({
exports: [
BaseComponent,
GnFacetsComponent,
GnResultsListComponent,
GnAggregatedRecordsComponent,
],
declarations: [
BaseComponent,
GnFacetsComponent,
GnResultsListComponent,
GnAggregatedRecordsComponent,
],
imports: [
CommonModule,
UiInputsModule,
UiSearchModule,
FeatureSearchModule,
StoreModule.forRoot({}),
EffectsModule.forRoot(),
UtilI18nModule,
TranslateModule.forRoot(TRANSLATE_GEONETWORK_CONFIG),
StoreDevtoolsModule.instrument(),
],
providers: [
{
provide: Configuration,
useValue: apiConfiguration,
},
SearchFacade,
],
})
export class WebcomponentsModule implements DoBootstrap {
constructor(private injector: Injector) {
CUSTOM_ELEMENTS.forEach((ceDefinition) => {
const angularComponent = ceDefinition[0]
const ceTagName = ceDefinition[1]
const customElement = createCustomElement(angularComponent, {
injector,
})
if (!customElements.get(ceTagName)) {
customElements.define(ceTagName, customElement)
}
})
}
// eslint-disable-next-line
ngDoBootstrap() {}
}
Example #16
Source File: app.module.ts From wingsearch with GNU General Public License v3.0 | 5 votes |
@NgModule({
declarations: [
AppComponent,
SearchComponent,
DisplayComponent,
BonusCardOptionComponent,
BirdCardComponent,
BonusCardComponent,
IconizePipe,
StatsComponent,
CardDetailComponent,
ConsentComponent,
BirdCardDetailComponent,
BonusCardDetailComponent,
TranslatePipe,
LanguageDialogComponent,
AnalyticsEventDirective,
ApplinkDirective,
SafePipe,
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
InfiniteScrollModule,
MatAutocompleteModule,
MatButtonModule,
MatCardModule,
MatChipsModule,
MatDialogModule,
MatExpansionModule,
MatFormFieldModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatSelectModule,
MatTooltipModule,
Ng5SliderModule,
ReactiveFormsModule,
StoreModule.forRoot({ app: appReducer, router: routerReducer }, {}),
StoreRouterConnectingModule.forRoot(),
StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: environment.production }),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
EffectsModule.forRoot([AppEffects]),
],
providers: [
AnalyticsService,
CookiesService,
TranslatePipe,
],
bootstrap: [AppComponent],
entryComponents: [
BirdCardDetailComponent,
BonusCardDetailComponent,
LanguageDialogComponent,
]
})
export class AppModule { }
Example #17
Source File: app.module.ts From digital-bank-ui with Mozilla Public License 2.0 | 5 votes |
@NgModule({
declarations: [AppComponent],
imports: [
RouterModule,
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
LoginModule,
/** Theme modules */
ThemeModule.forRoot(),
CoreModule.forRoot(),
NbSidebarModule.forRoot(),
NbMenuModule.forRoot(),
NbDatepickerModule.forRoot(),
NbWindowModule.forRoot(),
NbToastrModule.forRoot(),
NbEvaIconsModule,
/** ngrx root modules */
StoreModule.forRoot(
{ Root: reducer },
{
runtimeChecks: {
strictActionImmutability: false,
},
},
),
EffectsModule.forRoot([
SecurityApiEffects,
SecurityRouteEffects,
SecurityNotificationEffects,
RoleSearchApiEffects,
UserSearchApiEffects,
CustomerSearchApiEffects,
OfficeSearchApiEffects,
]),
StoreDevtoolsModule.instrument({
name: 'Digital bank',
}),
],
providers: [
HttpClientService,
AuthenticationService,
PermittableGroupIdMapper,
IdentityService,
NotificationService,
ExistsGuardService,
DepositAccountService,
CurrencyService,
AccountingService,
ImageService,
PayrollService,
CustomerService,
CatalogService,
OfficeService,
CountryService,
TellerService,
ChequeService,
...appRoutingProviders,
],
bootstrap: [AppComponent],
})
export class AppModule {}