# Interface Provider

The API for registering different types of providers with the injector.

This interface is used within AngularTS's `$provide` service to define services, factories, constants, values, decorators, etc.

interface Provider {
constant(name: string, val: any): Provider;
decorator(name: string, fn: Function): Provider;
directive(name: string, directive: DirectiveFactory): Provider;
directive(obj: Record<string, DirectiveFactory>): Provider;
factory(name: string, factoryFn: Injectable): Provider;
provider(name: string, provider: Function): Provider;
provider(obj: Record<string, Function>): Provider;
service(name: string, constructor: Injectable): Provider;
value(name: string, val: any): Provider;
}

##### Index

### Methods

constant
decorator
directive
factory
provider
service
value

## Methods

### constant

- constant(name: string, val: any): Provider

  Register a constant value (available during config).

  #### Parameters

  - name: string

    The name of the constant.

  - val: any

    The constant value.

  #### Returns Provider

### decorator

- decorator(name: string, fn: Function): Provider

  Register a decorator function to modify or replace an existing service.

  #### Parameters

  - name: string

    The name of the service to decorate.

  - fn: Function

    A function that takes `$delegate` and returns a decorated service.

  #### Returns Provider

### directive

- directive(name: string, directive: DirectiveFactory): Provider

  Register a directive

  #### Parameters

  - name: string

    The name of the directive.

  - directive: DirectiveFactory

    An object with a `$get` property that defines how the service is created.

  #### Returns Provider

- directive(obj: Record<string, DirectiveFactory>): Provider

  Register multiple directives

  #### Parameters

  - obj: Record<string, DirectiveFactory>

  #### Returns Provider

### factory

- factory(name: string, factoryFn: Injectable): Provider

  Register a factory function to create a service.

  #### Parameters

  - name: string

    The name of the service.

  - factoryFn: Injectable

    A function (or annotated array) that returns the service instance.

  #### Returns Provider

### provider

- provider(name: string, provider: Function): Provider

  Register a service provider.

  #### Parameters

  - name: string

    The name of the service.

  - provider: Function

    An object with a `$get` property that defines how the service is created.

  #### Returns Provider

- provider(obj: Record<string, Function>): Provider

  Register multiple service providers

  #### Parameters

  - obj: Record<string, Function>

  #### Returns Provider

### service

- service(name: string, constructor: Injectable): Provider

  Register a constructor function to create a service.

  #### Parameters

  - name: string

    The name of the service.

  - constructor: Injectable

    A class or function to instantiate.

  #### Returns Provider

### value

- value(name: string, val: any): Provider

  Register a fixed value as a service.

  #### Parameters

  - name: string

    The name of the service.

  - val: any

    The value to use.

  #### Returns Provider