Posts

Showing posts from April, 2020

Sharing Data from child to parent in angular 8 using @viewChild

Introduction In this article, we are going to learn how to share data from child to parent component in angular 8 using @ViewChild.   What is a @ViewChild ?   A  ViewChild  is a component if we want to access a child component, directive, DOM element inside the parent component, we use the decorator @ ViewChild () in  Angular .   Prerequisites Basic knowledge of Angular Visual Studio Code must be installed Angular CLI must be installed Node JS must be installed Step 1 Let's create a new Angular project using the following NPM command, ng  new  sharingData     Step 2 Now, let's create a parent component by using the following command, ng g c parent    Step 3 Now, open the parent.component.html file and add the following code in the file,   < div   class = "card" >         < div   class = "card-body pb-0" >             < h4   style = "text-ali