# 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): void;
decorator(name: string, fn: Injectable): void;
factory(name: string, factoryFn: Injectable): ServiceProvider;
provider(name: string, provider: ServiceProvider): ServiceProvider;
service(name: string, constructor: Injectable): ServiceProvider;
value(name: string, val: any): ServiceProvider;
}

- Defined in src/interface.ts:52

##### Index

### Methods

constant
decorator
factory
provider
service
value

## Methods

### constant

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

  Register a constant value (available during config).

  #### Parameters

  - name: string

    The name of the constant.

  - val: any

    The constant value.

  #### Returns void

  - Defined in src/interface.ts:86

### decorator

- decorator(name: string, fn: Injectable): void

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

  #### Parameters

  - name: string

    The name of the service to decorate.

  - fn: Injectable

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

  #### Returns void

  - Defined in src/interface.ts:93

### factory

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

  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 ServiceProvider

  - Defined in src/interface.ts:65

### provider

- provider(name: string, provider: ServiceProvider): ServiceProvider

  Register a service provider.

  #### Parameters

  - name: string

    The name of the service.

  - provider: ServiceProvider

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

  #### Returns ServiceProvider

  - Defined in src/interface.ts:58

### service

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

  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 ServiceProvider

  - Defined in src/interface.ts:72

### value

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

  Register a fixed value as a service.

  #### Parameters

  - name: string

    The name of the service.

  - val: any

    The value to use.

  #### Returns ServiceProvider

  - Defined in src/interface.ts:79