From the course: Building Angular and ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

NgRx store

NgRx store

From the course: Building Angular and ASP.NET Core Applications

Start my 1-month free trial

NgRx store

- To handle the store side effects, we are going to create effect functions. So, let's see this in action. In here, go inside the store folder, which you can find inside src, app, and then store. In here, we are going to create a new file named book.effects.ts, and let's start creating this class. So, we are going to write export, class, BookEffects, and then, inside here, we are going to have a constructor where we are going to inject, first of all, the service, because now we don't want our components to directly interact with the services, we want the effects to do that for us. So here, let us write private, service, BookService, and here, let us also inject the actions. So, for that, we write in here, private, actions. Let's put a dollar sign, so we know that it's something related to observables, and then we write in here, actions. Let's go up here and import the actions, so, import actions from NgRx/effects, and…

Contents