Configuration

In your app's main module, register store module with initial state object as a first variable and value for identifying is it prod environment as second parameter.

Setup

where initial state looks like

initial-state.ts
export const initialState = {
    todos: <any[]>[],
    storage: {
        itemToStore: 'some value'
    },
    form: {
        condition: {
            new: true,
            used: false,
            notSpecified: false,
        },
        location: 'europe',
    }
};

In addition you can pass other variables to StoreModule.provideStore function

  • restoreStateFromServer - marks if state should be restored from server. For more information look at documentation Server Side Rendering (SSR) Default is false

  • collectHistory - should history be collected at all - default is true

  • storeHistoryItems - how many items should be stored. Default is 100

Last updated