Passing data from Parent component to Child component using Input tag
This is perhaps the most straightforward and simplest way of passing data in angular. This can be done using
@Input() tag as shown below.
Passing data from Child component to Parent component using Output tag
Similar to the
@Input() tag, Angular also provides an
@Output() tag, which is used to emit data from the child component to parent component using an
Passing data from Child component to Parent component using ViewChild
ViewChild tag in Angular allows us to inject child component into a parent component. This allows the parent to have access to the child’s public properties and functions. However, the child component is not available to the parent until the view has been initialized.
Hence, in order to access the child we need to use angular lifecycle hook