Reputation: 1031
I have question about Event Emitter in Angular2. This is really nice feature, but I wonder, that can I use it not from child to parent, but from parent to child.
In model child-> parent We declare some emitter in child component, and emit point, in html we set (emitter)="parentFunc($event)"
.
How we can do it in model parent child? it is possible? If not, shoud I use ViewChild instead?
Regards.
Upvotes: 1
Views: 4287
Reputation: 658017
Angular uses unidirectional data flow and gained huge performance benefits from that.
From parent to child you can use property binding
To pass data from child to parent events are used @Output()
.
Therefore there is a distinct mechanism for each direction and there shouldn't be any need to use @Output()
from parent to child.
Upvotes: 1