Web
Analytics
angular 4 viewchild example - Tutorial

For Consultation : +91 9887575540

Stay Connected :

  • ViewChild allows a one component to be injected into another.
  • This means we need to implement the AfterViewInit lifecycle hook to receive the data from the child.
  • ngAfterViewInit() is called after a component’s view, and its children’s views, are created. Its a lifecycle hook that is called after a component’s view has been fully initialized.

Step1: Create two components

ng g c myparent1 and ng g c mychild1

myparent1 Component





mychild1component

Output

ViewChild Example output in angular 5




Select your currency