the key of above object represents . Each reducer will have a Key and a Initial state which will passed to state.
let's see how to state, implement in our application.
// this is our store module which takes Array of reducer classes,
// and some config. when logger is true, we will print console on state update
StoreModule.forRoot([UsernameReducer], {
logger: true
})
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { StoreModule } from 'angular-store';
import { AppComponent } from './app.component';
import { UsernameReducer } from './app.compoenent.reducer';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
// this is our store module which takes Array of reducer classes,
// and some config. when logger is true, we will print console on state update
StoreModule.forRoot([UsernameReducer], {
logger: true
})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }