top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Angular(2/4/5) How to share the data between the components?

0 votes
438 views
In Angular(2/4/5) How to share the data between the components?
posted Dec 27, 2017 by Madhavi Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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

answer Dec 31, 2017 by Parampreet Kaur
...