Skip to content

Commit

Permalink
docs(decorators): remove statements toward module.decorator order
Browse files Browse the repository at this point in the history
Commit 6a2ebdb removes the caveat of declaring a provider prior to
decorating it through the module.decorator function.

Remove statements warning of the prior requirement for order of
operations.

See angular#12382, PR angular#14348, and [angular#14372 comment 206452412]
(angular#14372 (comment))
  • Loading branch information
sjbarker committed May 31, 2016
1 parent cfc8b41 commit 69841d3
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions docs/content/guide/decorators.ngdoc
Expand Up @@ -161,37 +161,6 @@ the end of the name. The `$delegate` provided is dictated by the type of service
This {@link api/ng/type/angular.Module#decorator function} is the same as the `$provide.decorator` function except it is
exposed through the module API. This allows you to separate your decorator patterns from your module config blocks.

Like with `$provide.decorator`, the `module.decorator` function runs during the config phase of the app. That means
you can define a `module.decorator` before the decorated service is defined.

Since you can apply multiple decorators, it is noteworthy that decorator application always follows order
of declaration:

- If a service is decorated by both `$provide.decorator` and `module.decorator`, the decorators are applied in order:

```js
angular
.module('theApp', [])
.factory('theFactory', theFactoryFn)
.config(function($provide) {
$provide.decorator('theFactory', provideDecoratorFn); // runs first
})
.decorator('theFactory', moduleDecoratorFn); // runs seconds
```

- If the service has been declared multiple times, a decorator will decorate the service that has been declared
last:

```js
angular
.module('theApp', [])
.factory('theFactory', theFactoryFn)
.decorator('theFactory', moduleDecoratorFn)
.factory('theFactory', theOtherFactoryFn);

// `theOtherFactoryFn` is selected as 'theFactory' provider and it is decorated via `moduleDecoratorFn`.
```

## Example Applications

The following sections provide examples each of a service decorator, a directive decorator, and a filter decorator.
Expand Down

0 comments on commit 69841d3

Please sign in to comment.