In Angular, we can share data in 2 ways.
1) Using Service
2) Using @Input/@Output
1) Using Service - Create a service with getter & setter. Access the service in components through dependency injection.
2) Using @Input/@Output
Input and Output are two decorators in Angular responsible for communication between two components
@Input
- Input used to pass the data from parent to child
@Output
- Output used to pass the data from child to parent