Search code examples
angularserviceparent-childparent

What defines two components into family ?


I was reading this article (https://angular.io/guide/component-interaction#top) and i came across this section and i noticed they use terms Parent , child and family a lot .

for example here :

Parent and children communicate via a service

A parent component and its children share a service whose interface enables bi-directional communication within the family.

What makes two component part of the "family" ?Are all components of angular parts of one big family ? Or is there something that defines them as members of the same ?


Solution

  • Angular apps are structured as tree of components.Angular has uni-directional flow, that means that events go up from child to parent and inputs go down from parent to child. You can also use another way of communication and that is service where you can inject service in other components and share data between components.