Adding Providers to AngularJS Modules

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 dependency injector and the provider function that defines how to build the specific object. The following sections describe these methods in more detail.

Specialized AngularJS Object Providers

The Module object provides special constructor methods to add providers for the AngularJS objects that you need to implement in your modules. These specialized methods allow you to add definitions ...

Get Node.js, MongoDB, and AngularJS Web Development 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.