Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Add provider.$decorator to angular.Module #11300

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ function setupModuleLoader(window) {
*/
constant: invokeLater('$provide', 'constant', 'unshift'),

/**
* @ngdoc method
* @name angular.Module#decorator
* @module ng
* @param {string} name service name
* @param {Function} providerType Construction function for creating new instance of the
* service.
* @description
* See {@link auto.$provide#decorator $provide.decorator()}.
*/
decorator: invokeLater('$provide', 'decorator'),

/**
* @ngdoc method
* @name angular.Module#animation
Expand Down
2 changes: 2 additions & 0 deletions test/loaderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('module loader', function() {
var myModule = window.angular.module('my', ['other'], 'config');

expect(myModule.
decorator('dk', 'dv').
provider('sk', 'sv').
factory('fk', 'fv').
service('a', 'aa').
Expand All @@ -46,6 +47,7 @@ describe('module loader', function() {
expect(myModule.requires).toEqual(['other']);
expect(myModule._invokeQueue).toEqual([
['$provide', 'constant', ['abc', 123]],
['$provide', 'decorator', ['dk', 'dv']],
['$provide', 'provider', ['sk', 'sv']],
['$provide', 'factory', ['fk', 'fv']],
['$provide', 'service', ['a', 'aa']],
Expand Down