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

docs($provide): Decorator method in summary #14562

Closed
wants to merge 3 commits into from
Closed
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
18 changes: 10 additions & 8 deletions src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ function annotate(fn, strictDi, name) {
* * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
* that will be wrapped in a **service provider** object, whose `$get` property will instantiate
* a new object using the given constructor function.
* * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function**,
* `decorFn`, with the {@link auto.$injector $injector}, `name` the name of the provider to decorate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, name the name of the provider to decorate. -> ; name is the name of the provider to decorate.

*
* See the individual methods for more information and examples.
*/
Expand Down Expand Up @@ -615,18 +617,18 @@ function annotate(fn, strictDi, name) {
* @name $provide#decorator
* @description
*
* Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
* intercepts the creation of a service, allowing it to override or modify the behavior of the
* service. The object returned by the decorator may be the original service, or a new service
* object which replaces or wraps and delegates to the original service.
* Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
* intercepts the creation of a provider, allowing it to override or modify the behavior of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provider, -> provider (and also directives and filters),

* provider. The object returned by the decorator may be the original provider, or a new provider
* object which replaces or wraps and delegates to the original provider.
*
* @param {string} name The name of the service to decorate.
* @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
* instantiated and should return the decorated service instance. The function is called using
* @param {string} name The name of the provider to decorate.
* @param {Function|Array.<string|Function>} decorator This function will be invoked when the provider needs to be
* instantiated and should return the decorated provider instance. The function is called using
* the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
* Local injection arguments:
*
* * `$delegate` - The original service instance, which can be monkey patched, configured,
* * `$delegate` - The original provider instance, which can be monkey patched, configured,
* decorated or delegated to.
*
* @example
Expand Down