Create root app state module
This commit is contained in:
parent
0b2bfa8406
commit
c452fbc5ef
3 changed files with 17 additions and 0 deletions
|
@ -1,15 +1,23 @@
|
||||||
import {
|
import {
|
||||||
ApplicationConfig,
|
ApplicationConfig,
|
||||||
|
importProvidersFrom,
|
||||||
isDevMode,
|
isDevMode,
|
||||||
provideBrowserGlobalErrorListeners,
|
provideBrowserGlobalErrorListeners,
|
||||||
provideZonelessChangeDetection,
|
provideZonelessChangeDetection,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { StoreModule } from '@ngrx/store';
|
||||||
import { provideStoreDevtools } from '@ngrx/store-devtools';
|
import { provideStoreDevtools } from '@ngrx/store-devtools';
|
||||||
|
import { appStateReducer } from './state/state.reducer';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
provideZonelessChangeDetection(),
|
provideZonelessChangeDetection(),
|
||||||
|
importProvidersFrom(
|
||||||
|
StoreModule.forRoot({
|
||||||
|
app: appStateReducer,
|
||||||
|
})
|
||||||
|
),
|
||||||
provideStoreDevtools({
|
provideStoreDevtools({
|
||||||
maxAge: 25,
|
maxAge: 25,
|
||||||
logOnly: !isDevMode(),
|
logOnly: !isDevMode(),
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { StoreModule } from '@ngrx/store';
|
||||||
|
import { appStateReducer } from './state/state.reducer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
|
7
src/app/state/state.reducer.ts
Normal file
7
src/app/state/state.reducer.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { createReducer } from '@ngrx/store';
|
||||||
|
|
||||||
|
export interface AppState {}
|
||||||
|
|
||||||
|
export const initialState: AppState = {};
|
||||||
|
|
||||||
|
export const appStateReducer = createReducer(initialState);
|
Loading…
Add table
Reference in a new issue