Service Providers

The service providers are a unique category of providers because there is not already a specific format for the resulting provider objects. Instead, a provider acts as a service to provide functionality. AngularJS provides some specific creation methods for building services and exposes them through the following methods:

value(name, object): This is the most basic of all providers. The object parameter is simply assigned to name, so there is a direct correlation in the injector between the name value and the object value.

constant(name, object): This is similar to the value() method, but the value is not changeable. Also, constant() methods are applied before other provider methods.

factory(name, factoryFunction): This ...

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.