From the course: Angular State Management with NgRx

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Introduction to SignalStore

Introduction to SignalStore

- [Instructor] So, let's now introduce the Signal Store feature of NgRx Signals and see how it differs from the basic Signal state of our previous chapter. With Signal Store, we get access to more features than when using Signal State. The main idea of Signal Store is to generate a custom service where all of our state management features live in a single place. Let's take a look at an example applied to our weather application. With Signal Store, we still need to define what our data looks like and create a default state. So, DEFAULT_COUNTRIES, default shape of our states, and the initialState for that piece of information. And then, where things change a lot is that in order to create our store service, we just use a signalStore function and we pass a couple of parameters to it. First, we providedIn: 'root' and that's because we want to make sure that the service is available everywhere. And the second parameter is withState, and we pass our initialState as a parameter, and that's…

Contents