Component inter-communication
In a nutshell, Angular components expose a public API that allows them to communicate with other components. This API encompasses input properties, which we use to feed the component with data. It also exposes output properties we can bind event listeners to, thereby getting timely information about changes in the state of the component.
Let’s look at how Angular solves the problem of injecting data into and extracting data from components through quick and easy examples in the following sections.
Passing data using an input binding
We will expand our products
module and create a new component that will display the details of a product, such as a name and a price. Data representing the specific product details will be dynamically passed from the product list component.
For now, we will only pass and display the name of the product. To follow along with code samples, copy the CSS styles from the styles.css
file...