fix(ivy): support forward refs in @Inject annotations (#27069)

PR Close #27069
This commit is contained in:
Kara Erickson
2018-11-12 18:52:51 -08:00
committed by Andrew Kushnir
parent 123da1a8c2
commit e6e590479e
4 changed files with 31 additions and 0 deletions

View File

@ -8,6 +8,7 @@
import './ng_dev_mode';
import {resolveForwardRef} from '../di/forward_ref';
import {InjectionToken} from '../di/injection_token';
import {InjectFlags} from '../di/injector_compatibility';
import {QueryList} from '../linker';
@ -2653,6 +2654,7 @@ export function directiveInject<T>(token: Type<T>| InjectionToken<T>): T;
export function directiveInject<T>(token: Type<T>| InjectionToken<T>, flags: InjectFlags): T;
export function directiveInject<T>(
token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|null {
token = resolveForwardRef(token);
return getOrCreateInjectable<T>(
getPreviousOrParentTNode() as TElementNode | TContainerNode | TElementContainerNode,
getViewData(), token, flags);