ResolvedReflectiveProvider

An internal resolved representation of a Provider used by the Injector.

      
      interface ResolvedReflectiveProvider {
  key: ReflectiveKey
  resolvedFactories: ResolvedReflectiveFactory[]
  multiProvider: boolean
}
    

属性

属性说明
key: ReflectiveKey

A key, usually a Type<any>.

resolvedFactories: ResolvedReflectiveFactory[]

Factory function which can return an instance of an object represented by a key.

multiProvider: boolean

Indicates if the provider is a multi-provider or a regular provider.

使用说明

This is usually created automatically by Injector.resolveAndCreate.

It can be created manually, as follows:

Example

var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]); var injector = Injector.fromResolvedProviders(resolvedProviders); expect(injector.get('message')).toEqual('Hello');
      
      var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]);
var injector = Injector.fromResolvedProviders(resolvedProviders);

expect(injector.get('message')).toEqual('Hello');