# `decorator` ( service in module `AUTO` )

## Description

Decoration of service, allows the decorator to intercept the service instance creation. The returned instance may be the original instance, or a new instance which delegates to the original instance.

## Parameters

- `name – {string} –`

  The name of the service to decorate.

- `decorator – {function()} –`

  This function will be invoked when the service needs to be instanciated. The function is called using the `injector.invoke` method and is therefore fully injectable. Local injection arguments:

  - `$delegate` - The original service instance, which can be monkey patched, configured, decorated or delegated to.