top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

0 votes
69 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...