If a controller is supposed to be lightweight and only concern itself with the view it’s controlling, what happens when you need functionality to be available to your entire application? If a controller should never communicate directly with other controllers, how do they share information? Whereas controllers are constrained to a specific context, angularjs services exist to provide functionality that’s available to the entire application.
In this Tutorial we’ll explore what a service is and how to create a simple service. From there, we’ll show how to use services to communicate with a remote server and serve as a domain model for the entire application. After that we’ll dip our toes into some advanced functionality and see how to intercept remote server calls as well as decorate existing services.
Services and the big picture