Steps to create an Angular application
Step 1: Create an angular application using the following command.
ng new angular-com
Make sure angular is already installed in your system.
Step 2: Go inside the angular project
cd angular-com
Step 3: Next, we will run the application through the below command
ng serve --open
Step 4: Create the required component to share data between them.
ng generate component comp-alpha
ng generate component comp-beta
Component Communication in Angular
Angular, as a robust front-end framework, allows you to build complex and interactive web applications by creating reusable components. One of the key aspects of building such applications is effective communication between these components.
There are a lot of instances where we need to transfer data and events between angular components.
The communication can be between parent and child components or between sibling components. We will try out 3 methods to transfer data on our angular application.
Table of Content
- 1. Passing data from parent to child through input binding
- 2. Listening to events from the child component in the parent component
- 3. Using Services to pass data between sibling component