Angular Services as Your Single Source of Truth

The core of any application is its data model. In Angular, you store your data model, or your state, in one or more services. Services are singletons by default, which is one thing that makes them a natural fit. The other is Angular's dependency injection system, which allows us to inject those singletons anywhere we need them. Multiple components, other services, route guards, etc.

A single source of truth where you define all of your primary streams is a fantastic way to centralize the most important logic in the app. Components can then be as simple as possible, and only introduce logic when it is truly unique to their needs or view-specific.

Services are also great for top level settings like date formatting strings, expiration periods, and anything else that should stay consistent across the application.