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
17.2.1
Description
I think the changes in PR 28633 (a fix for #28614) may have caused a dependency injection issue when combining virtual scroll and drag and drop. I've setup a very minimal StackBlitz example to show the issue here: https://stackblitz.com/edit/f2xpkk. If you load the example as it is currently with version 17.2.2, you'll see the following stack trace:
vendor.js:47027 ERROR NullInjectorError: R3InjectorError(Standalone[CdkVirtualScrollAppendOnlyExample])[InjectionToken CDK_DRAG_PARENT -> InjectionToken CDK_DRAG_PARENT -> InjectionToken CDK_DRAG_PARENT]:
NullInjectorError: No provider for InjectionToken CDK_DRAG_PARENT!
at NullInjector.get (vendor.js:44290:21)
at R3Injector.get (vendor.js:44741:27)
at R3Injector.get (vendor.js:44741:27)
at R3Injector.get (vendor.js:44741:27)
at ChainedInjector.get (vendor.js:55693:32)
at lookupTokenUsingModuleInjector (vendor.js:46282:31)
at getOrCreateInjectable (vendor.js:46328:10)
at ɵɵdirectiveInject (vendor.js:49755:17)
at ɵɵinject (vendor.js:43467:59)
at inject (vendor.js:43550:10
Reproduction
StackBlitz link: https://stackblitz.com/edit/f2xpkk
Steps to reproduce:
- Open the StackBlitz and see the console error
- If you update all the Angular versions in the package file to 17.2.1 and reload, the error is no longer present
Expected Behavior
No stack trace error and page loads successfully
Actual Behavior
Console errors about dependency injection prevent the component from loading completely
Environment
- Angular: 17.2.2 (and 17.3.0)
- CDK/Material: 17.2.2 (and 17.3.0)
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows