How do i share data between sibling components in Angular dart


How to share data to sibling component in Angular dart

How to share data dynamically between sibling components
Could you please explain with an example



  • You can use a shared service that is provided by the parent component or another common ancestor, inject it in both components and use it as mediator, for example with streams to actively notify about state changes.

  • You can also use a field in the parent component that you pass to both

<sibling1 [data]="dataInParent"></sibling1>
<sibling2 [data]="dataInParent"></sibling1>
  • You can reference use references in the template of the parent component
<sibling1 #foo1></sibling1>
<sibling2 [data]=""></sibling1>

Answered By – Günter Zöchbauer

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *