-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/select
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
16
Description
Using @defer
where the inner component has a mat select causes No provider for InjectionToken mat-select-scroll-strategy! Error. This happens when the component that has the defer block does not import MatSelectModule in its imports array. This happen even if the nested component that has the mat-select does import the MatSelectModule .
Reproduction
StackBlitz link: https://stackblitz.com/edit/npjg8f?file=src%2Fexample%2Fselect-overview-example.html
Steps to reproduce:
- Use
@defer(with condition)
where a nested component has a mat-select.
Like@defer(with condition){<app-a> <app-b/> </app-a>}
and<app-b>
has amat-select
inside of it. - The component that has the
@defer
does not import MatSelectModule in its imports array,<app-b>
does. - When the defer conditon is fuffilled, the error will occur.
Expected Behavior
No error and everything should work.
Actual Behavior
vendor.js:43656 ERROR NullInjectorError: R3InjectorError(Environment Injector)[InjectionToken mat-select-scroll-strategy -> InjectionToken mat-select-scroll-strategy]:
NullInjectorError: No provider for InjectionToken mat-select-scroll-strategy!
at NullInjector.get (vendor.js:37713:21)
at R3Injector.get (vendor.js:38164:27)
at R3Injector.get (vendor.js:38164:27)
at ChainedInjector.get (vendor.js:47251:32)
at lookupTokenUsingModuleInjector (vendor.js:36272:31)
at getOrCreateInjectable (vendor.js:36318:10)
at Module.ɵɵdirectiveInject (vendor.js:43878:17)
at NodeInjectorFactory.MatSelect_Factory [as factory] (src_example_my_ts.js:19241:1454)
at getNodeInjectable (vendor.js:36512:38)
at instantiateAllDirectives (vendor.js:44650:23)
Environment
- Angular: 17
- CDK/Material: 17
- Browser(s): Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
AYBox, alexfriesen and jczacharia
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/select