Angular has different mechanisms for sharing data between components. The choice of the sharing method mostly depends on the relationship of the related components. Typically, within the context of a parent-child topology, the most straightforward choice would be to use the
@Output decorators. For sibling components, relying on a data sharing service seems to be the most obvious solution. In any case, once you have settled on the choice of a communication topology, you need to decide which data propagating mechanism to use.
Generally, components use
EventEmmiter objects to share data with each other. When you pass data into an Angular component with an
@Input decorator, you are actually using an
EventEmitter object. Although this solution is appropriate for the majority of situations, this is not always the case. Let’s consider the following example: