Plugging It All Together

Let's update the application to talk to this new state store.

Updating the Root module

Before you modify any components or services, you need to register ngrx and the reducer you created with the root module. Let’s open app.module.ts and make the following modifications:

Press + to interact
import { StoreModule } from '@ngrx/store';
import { patientReducer } from './state';
@NgModule({
imports: [
BrowserModule,
ReactiveFormsModule,
StoreModule.forRoot({
})
],
... etc
})
  • Line 8: forRoot sets up the store object you’ve just used throughout the rest of the application. The argument defines store. Every key is a key of the store, as
...