Plugging It All Together
Let's update the application to talk to this new state store.
We'll cover the following...
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:
sets up theforRoot
object you’ve just used throughout the rest of the application. The argument definesstore
. Every key is a key of the store, asstore