Describes how an Injector should instantiate a given token.

See provide and the Dependency Injection page of the Angular Guide.

var injector = Injector.resolveAndCreate([
  new Provider("message", useValue: 'Hello')
]);
 
expect(injector.get('message'), 'Hello');

Constructors

Provider(token, { Type useClass, useValue: noValueProvided, useExisting, Function useFactory, String useProperty, List<Object> deps, bool multi })

const

Properties

dependencies → List<Object>

Specifies a set of dependencies (as tokens) which should be injected into the factory function.

read-only
hashCode → int

Get a hash code for this object.

read-only, inherited
multi → bool

Creates multiple providers matching the same token (a multi-provider).

read-only
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
token → dynamic

Token used when retrieving this provider. Usually, it is a type Type.

read-only
useClass → Type

Binds a DI token to an implementation class.

read-only
useExisting → dynamic

Binds a DI token to an existing token.

read-only
useFactory → Function

Binds a DI token to a function which computes the value.

read-only
useProperty → String

Specifies the property of the configuration class to use as value.

read-only
useValue → dynamic

Binds a DI token to a value.

read-only

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited