AngularJS services are singleton objects that you can register with the dependency injector; controllers and other AngularJS components, including other services, can consume them. AngularJS provides much of the backend functionality in services, such as $http
, which allows you to easily integrate webserver communication into your AngularJS applications.
AngularJS provides several methods for creating custom services, with varying levels of complexity. The value
and constant
methods create simple services. On the other hand, the factory
and service
methods allow you to create much more complex services.