Reputation: 1514
I've two equal components
<component><component>
<component><component>
I need that if one of them change the another one change too, e.g if I've a function that when I click the element write 'hello' if i do it in one of them it be reflected in both components, how can i achieve that?
thanks in advance!
Upvotes: 2
Views: 108
Reputation: 657008
<component #c1 (click)="c2.title = 'hello'"><component>
<component #c2 (click)="c1.title = 'hello'"><component>
For other ways see https://angular.io/docs/ts/latest/cookbook/component-communication.html
Upvotes: 2