There are many code examples that demonstrate component communication,
I am confused about what is the difference between that two techniques
- ChildComponent
- ViewChild
ViewChild is defined:
ViewChild decorator get access to a child component, directive or a DOM element from a parent component class, ViewChild returns the first element that matches a given component, directive or template reference selector.
According to this reference,
The ViewChild give full access to the parent component to the DOM elements, directive without to send EventEmitter to the parent component on any updates.
my questions
- we can say the relation between parent component and viewchild is only one-way biding, and between parent component and child component is 2-way binding?
How the act under the core, data Binding, Lifecycle?
What are the real practical usages, and which problem it comes to solve?