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: Source code with comments

Solution: Source code with comments - Angular Tutorial

From the course: Learning NgRx

Start my 1-month free trial

Solution: Source code with comments

(chime) - [Instructor] So here's one possible study shown to this second challenge. The first thing is we want to implement to remove zip code feature. So we have to actually handle the click on the close button. So that's what I do right here on line 17 of the current conditions component the html. Unclick, I'm going to call the message remove zip and pass the zip code as a parameter. And then, in our current conditions component dot ts, we implement that remove zip message down here on line 29, getting the zip code that we passed earlier. And all we do with this is dispatch a new action and the action is of course remove zip code. The payload being our zip code. And that's really it. That's all of the code we had to write. And that's really where NgRx becomes very helpful. Once we take the time to create all of that state, all of those actions, and reducers, getting them in to play and having some features added becomes very easy because all we do is really dispatch actions or react…

Contents