Answer the question
In order to leave comments, you need to log in
How to pass data between components in Angular2?
Hello, friends. Consultation is needed on how to properly implement saving and passing data in Angular2. While a simple method is implemented, authorization occurs in service and is stored there as an object. It is possible to pull the method of this service, let's say userService.getUser () and it will return the user object to me.
I also saw when they save some data in the model itself. Tell me how to do it correctly?
Answer the question
In order to leave comments, you need to log in
To transfer data between components - @Input() @Output(), with this it is convenient to write reusable controls)
specify what data you want to store
1) If just to display View, then from the service, then to the model
2) if this is authentication, then store in localStorage user token, etc.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question