• Overview
@angular/core

EnvironmentInjector

Class

An Injector that's part of the environment injector hierarchy, which exists outside of the component tree.

  
    abstract class EnvironmentInjector implements Injector {
}

get

5 overloads

Retrieves an instance from the injector based on the provided token.

@paramtokenProviderToken<T>
@paramnotFoundValueundefined
@paramoptionsInjectOptions & { optional?: false | undefined; }
@returnsT

Retrieves an instance from the injector based on the provided token.

@paramtokenProviderToken<T>
@paramnotFoundValuenull | undefined
@paramoptionsInjectOptions
@returnsT | null

Retrieves an instance from the injector based on the provided token.

@paramtokenProviderToken<T>
@paramnotFoundValueT | undefined
@paramoptionsInjectOptions | undefined
@returnsT

Retrieves an instance from the injector based on the provided token.

@deprecated

use object-based flags (InjectOptions) instead.

@paramtokenProviderToken<T>
@paramnotFoundValueT | undefined
@paramflagsInjectFlags | undefined
@returnsT
@deprecated

from v4.0.0 use ProviderToken

@paramtokenany
@paramnotFoundValueany
@returnsany

runInContext

ReturnT

Runs the given function in the context of this EnvironmentInjector.

Within the function's stack frame, inject can be used to inject dependencies from this injector. Note that inject is only usable synchronously, and cannot be used in any asynchronous callbacks or after any await points.

@deprecated

use the standalone function runInInjectionContext instead

@paramfn() => ReturnT

the closure to be run in the context of this injector

@returnsReturnT

destroy

void
@returnsvoid
Jump to details