Skip to content

cdkVirtualFor does not work in ng-content #15277

@vthinkxie

Description

@vthinkxie

What is the expected behavior?

when *cdkVirtualFor in ng-content, and cdk-virtual-scroll-viewport in parent component, everything works fine.

What is the current behavior?

when *cdkVirtualFor in ng-content, and cdk-virtual-scroll-viewport in parent component, error happend

ERROR
Error: StaticInjectorError(AppModule)[CdkScrollable -> CdkVirtualScrollViewport]: 
StaticInjectorError(Platform: core)[CdkScrollable -> CdkVirtualScrollViewport]: 
NullInjectorError: No provider for CdkVirtualScrollViewport!

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

https://stackblitz.com/edit/angular-oqcthb?file=src/app/app.component.html

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/scrolling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions