AngularTS
    Preparing search index...

    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;
    }
    Index

    Methods

    • Register a constant value (available during config).

      Parameters

      • name: string

        The name of the constant.

      • val: any

        The constant value.

      Returns 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

    • 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

    • Register a fixed value as a service.

      Parameters

      • name: string

        The name of the service.

      • val: any

        The value to use.

      Returns ServiceProvider