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.
Solution: Use SignalState in our application - Angular Tutorial
From the course: Angular State Management with NgRx
Solution: Use SignalState in our application
(upbeat music) - [Instructor] Here is one possible solution to this coding challenge. So in our country store, we want to support and store what is the currently selected country. So we change our state and add another entry, selectedCountry of type string. And all we're going to need here is the code. So we just need a short string of two letters to store that info. By default in our initial state, we don't have any selected country, so we make that an empty string. And then what we are going to do is add a method on our store so we can update our state and select a country. So we call it selectCountry. We receive the selection as a string and we use the same patchState as before to patch our state and set our selectedCountry. And that's all we need to change in our country store. Now what we need to do is really call that method inside our component. So the selection of our country happens in zipcode entry component. This is our dropdown. And when we select a value we want to…