AngularJS services are singleton objects, which means only one instance is ever created. The intent of a service is to provide a concise bit of code that performs specific tasks. A service can be as simple as providing a value definition or as complex as providing full HTTP communication to a webserver.
A service provides a container for reusable functionality that is readily available to AngularJS applications. Services are defined and registered with AngularJS’s dependency injection mechanism. This allows you to inject services into modules, controllers, and other services.
Note
Chapter 21, “Understanding AngularJS Modules and Dependency Injection,” discusses dependency injection. You should read that chapter if you haven’t already before continuing on with this one.