Creating Providers in AngularJS Modules

AngularJS provides a number of built-in providers for various objects and services. For example, the $window service has a provider that builds the AngularJS service object that enables you to interact with the underlying Window object in JavaScript. In addition to these providers, you can create providers of your own to inject functionality into AngularJS application components.

The Module object provides several helper methods for adding providers as an alternative to using the config() method. These methods are simpler to use and clearer in your code. You can add two types of provider objects to AngularJS modules. Each of these methods accepts two parameters: the name that will be registered with the ...

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.