From the course: Learning NgRx

Unlock the full course today

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

Solution: Short video

Solution: Short video - Angular Tutorial

From the course: Learning NgRx

Start my 1-month free trial

Solution: Short video

(light music) - [Narrator] So here is one possible solution to this first challenge. On this first screen, the first obvious action is linked to the only thing we can do at this point, which is add a new location. So, that's a first action right here. Add location, and it's payload would have to be the entered zip code. Because of that, we can tell right away that our state would have a list of zip codes to store all of these locations. In my case, right now, the array of zip codes would have just one location, which is in New York City. We also see if the locations can be removed from the screen. So that's another action, remove location, that we would use to do that. Now each location in our list renders it's current weather conditions. So we likely have a get current conditions action that takes a zip code as a payload. Such current conditions will be stored as part of our state as well. So we'd have a current conditions map in our state that maps a zip code to the current…

Contents