fix(ivy): properly inject all special token types (#24862)

Previously ngtsc had a few bugs handling special token types:

* Injector was not properly translated to INJECTOR
* ChangeDetectorRef was not injected via injectChangeDetectorRef()

This commit fixes these two bugs, and also adds a test to ensure
they continue to work correctly.

PR Close #24862
This commit is contained in:
Alex Rickabaugh
2018-07-10 09:57:48 -07:00
committed by Victor Berchet
parent 53a16006d6
commit f9a6a175bf
5 changed files with 59 additions and 1 deletions

View File

@ -53,6 +53,9 @@ export function getConstructorDependencies(
const importedSymbol = reflector.getImportOfIdentifier(tokenExpr);
if (importedSymbol !== null && importedSymbol.from === '@angular/core') {
switch (importedSymbol.name) {
case 'ChangeDetectorRef':
resolved = R3ResolvedDependencyType.ChangeDetectorRef;
break;
case 'ElementRef':
resolved = R3ResolvedDependencyType.ElementRef;
break;