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.

Component architecture in action

Component architecture in action - Angular Tutorial

From the course: Learning NgRx

Start my 1-month free trial

Component architecture in action

- [Instructor] In this video, we're going to implement the recommended component architecture with ngrx. So, the first thing I'm going to do is change a zip code entry component. Right now, it has all of the business logic in here and we want to move this to the container component, which is a main page component. So, what I'm gonna do is just cut the code from that component here and move it to main page component dot ts. So that way the business logic is now in the container component. And back to my zip code entry component. So, what I'm going to do in that component is have an output. That way, whenever we enter a zip code, it's gonna be sent to the parent. I'm gonna code that output zip added. And with Angular, the convention for this is to use an event emitter object, and it's gonna be an event emitter of string. And now that have that event emitter in place, all I need to do is to actually use it in the html template for that zip code entry component. So, I'm going to the html…

Contents