fix(ivy): reorder provider type checks to align with VE (#34433)

The ordering matters because we don't currently throw if multiple
configurations are provided (i.e. provider has *both* useExisting and
useFactory). We should actually throw an error in this case, but to
avoid another breaking change in v9, this PR simply aligns the Ivy
behavior with ViewEngine.

PR Close #34433
This commit is contained in:
Andrew Scott
2019-12-16 10:03:09 -08:00
committed by Kara Erickson
parent 6607fb496a
commit 7916b1e595
2 changed files with 34 additions and 2 deletions

View File

@ -482,10 +482,10 @@ export function providerToFactory(
} else {
if (isValueProvider(provider)) {
factory = () => resolveForwardRef(provider.useValue);
} else if (isExistingProvider(provider)) {
factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
} else if (isFactoryProvider(provider)) {
factory = () => provider.useFactory(...injectArgs(provider.deps || []));
} else if (isExistingProvider(provider)) {
factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
} else {
const classRef = resolveForwardRef(
provider &&