mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
When registering providers, the DI system assumes that `viewProviders` are registered before plain `providers`. This was reinforced by components always being first in the array of directive matches, only one component being allowed per node and the fact that only components can have `viewProviders`.
This breaks down if there are host directives with `providers` on the component, because they'll execute earlier, throwing off the order of operations.
These changes fix the issue by separating out the resolvers for `viewProviders` and plain `providers` and explicitly running the component's `viewProviders` resolver before any others. This also has the benefit of not attempting to resolve `viewProviders` for directives which are guaranteed not to have them.
Fixes #65724.
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| application_error_handler.ts | ||
| async.ts | ||
| component_fixture.ts | ||
| defer.ts | ||
| fake_async.ts | ||
| logger.ts | ||
| metadata_override.ts | ||
| metadata_overrider.ts | ||
| resolvers.ts | ||
| styling.ts | ||
| test_bed.ts | ||
| test_bed_common.ts | ||
| test_bed_compiler.ts | ||
| test_hooks.ts | ||
| testing.ts | ||
| testing_internal.ts | ||
| testing_private_export.ts | ||