December 2014
Intermediate to advanced
346 pages
6h 14m
English
Service providers are the parent service type used for factories and services. They are the most configurable and extensible of the service types, and allow you to inspect and modify other service types during the application's initialization.
Service providers take a function parameter that returns an object that has a $get method. This method is what AngularJS will use to produce the injected value after the application has been initialized. The object wrapping the $get method is what will be supplied if the service provider is injected into the config phase. This can be implemented as follows:
(app.js)
angular.module('myApp', [])
.config(function(PlayerProvider) { // appending 'Provider' to the injectable ...Read now
Unlock full access