O'Reilly logo

Rails, Angular, Postgres, and Bootstrap, 2nd Edition by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sharing Data Between Components

Each component displays a different part of the customer’s data. We don’t want each component to hit the server for their part of the UI—that would result in multiple calls fetching the same data. Instead, we’d like the components to be in charge displaying (and later, changing) the data, but have the data handed to them from somewhere else. Because we’re already fetching it in the CustomerDetailsComponent, we just need a way to pass it to the other components.

Let’s start with the CustomerInfoComponent, which displays the customer’s name, username, join date, and email address. We have that information in CustomerDetailsComponent, so how can we pass it along to CustomerInfoComponent?

You’ve seen in Changing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required