Angular v4: Do we store data in a Service or the Component or both?
After reviewing quite a few tutorials, as well as reading the documentation of Angular, I'm still not clear on this subject.
https://angular.io/tutorial/toh-pt2 Angular's tutorial clearly shows data stored in the Component.
https://angular.io/guide/architecture#services Angular's Architecture > Services section shows code with the service having an array of data (is this proper?).
If we store data in Components, we would heavily used @Input and @Output to move data between child components (assuming we want this data in the front end), however this poses a problem when we use routing, we would need our new Component which loaded from the router-outlet to make a new call to our service for a promise to make the API call to our server to hold data. Possibly in this case we would have 2 components holding the same data - however they may not match.
If we store data in a Service, we would heavily use our Services to retrieve data, and manipulate data (assuming we want this data in the front end) this way our service holds 1 set of data, and each component may call on the service data at any time to get consistent data.
--
What is the proper way of storing data? Is one of the other not advised?