Skip to content

bug(cdk/scrolling): Documentation for using cdk-virtual-scroll-viewport is incorrect  #20112

@howardjing

Description

@howardjing

Reproduction

The API reference for Angular CDK scrolling (https://material.angular.io/cdk/scrolling/api) only mentions CdkScrollableModule and does not mention ScrollingModule. ScrollingModule should be mentioned in the documentation -- for example it is required to use cdk-virtual-scroll-viewport.

From the documentation:

API reference for Angular CDK scrolling
import {CdkScrollableModule} from '@angular/cdk/scrolling';

In order to use cdk-virtual-scroll-viewport, I need to import ScrollingModule from @angular/cdk/scrolling instead.

Steps to reproduce:

  1. Go to the following StackBlitz: https://stackblitz.com/edit/angular-ivy-xt5sg3?file=src%2Fapp%2Fapp.module.ts. You will see the following error:
    Error in src/app/app.component.html (2:1)
    'cdk-virtual-scroll-viewport' is not a known element:
    1. If 'cdk-virtual-scroll-viewport' is an Angular component, then verify that it is part of this module.
    2. If 'cdk-virtual-scroll-viewport' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the 
    '@NgModule.schemas' of this component to suppress this message.
    
  2. Import ScrollingModule and it will work again.

Expected Behavior

I expect the documentation at https://material.angular.io/cdk/scrolling/api to mention ScrollingModule, something along the lines of

API reference for Angular CDK scrolling

/**
 * To use the following:
 * - CdkScrollable
 */
import {CdkScrollableModule} from '@angular/cdk/scrolling';

/**
 * To use the following:
 *  - CdkFixedSizeVirtualScroll
 *  - CdkVirtualForOf
 *  - CdkVirtualScrollViewport
 */
import {ScrollingModule} from '@angular/cdk/scrolling';

Actual Behavior

The documentation does not mention ScrollingModule

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/scrollingdocsThis issue is related to documentationgood first issueThis issue is a good place to start for first time contributors to the projecthelp wantedThe team would appreciate a PR from the community to address this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions