When you develop an app that involves a lot of pages and communication to the backend, you will need to have a way to communicate across the pages and components. For example, you may have a service to request user data from the backend and store it in a common local service. Then, you will need to provide a way for the user to update their user data and see the update in real time. When the user navigates to different pages, the same information will be pulled and rendered as well without making multiple trips to the backend. This is a very common scenario that requires the use of the
@Injectable decorator in Angular 2.
Observe the following screenshot of the app you will build:
The user ...