ResolvedReflectiveProvider
供 Injector
使用的 Provider
的内部解析表示形式。
An internal resolved representation of a Provider
used by the Injector
.
interface ResolvedReflectiveProvider {
key: ReflectiveKey
resolvedFactories: ResolvedReflectiveFactory[]
multiProvider: boolean
}
属性
属性 | 说明 |
---|---|
key: ReflectiveKey | |
resolvedFactories: ResolvedReflectiveFactory[] | 可以返回 Key 表示的对象实例的工厂函数。 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. |
使用说明
这通常是由 Injector.resolveAndCreate
自动创建的。
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');