From the course: Angular State Management with NgRx
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Entities to manage record collections - Angular Tutorial
From the course: Angular State Management with NgRx
Entities to manage record collections
- [Instructor] So now let's assume for a minute that our application somehow has to manage a list of users with all of the associated actions, creating, updating, deleting a user of that list. Now, if we had to create all of the actions and reducers and effects and all of that manually, it'll take quite some time. So NgRx created a specific schematics and package for that specific purpose called entity. Let's give it a try to see what this actually does. So as always, we head to our terminal and we add this other package, ng add @ngrx/entity@latest. We proceed with the install. And now that we have this package available, I can easily create my first entity. So we mentioned that we would have a list of users, so using ng generate entity User, always using the group option to create the least amount of files possible. And as we do this, the Angular CLI tells us what was generated. So we see that we got actions, a model, reducer, and a unit test for that reducer that was automatically…