question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jelbourncommented, Aug 4, 2020

Yeah, it’s not the most obvious process. We have a bazel rule that takes all our documentation content and bundles it into an npm package, then we install that npm package into the docs site. So you would do this:

# in angular/components, build the npm package
yarn bazel build src/components-examples:npm_package

# copy the output from bazel's bin directory to somewhere more useful
cp -r $(yarn --silent bazel info bazel-bin)/src/components-examples/npm_package /tmp/docs-content/

# pack the docs content package into a .tgz file for easy consumption
cd /tmp
npm pack ./docs-content

# in the angular/material.angular.io repo, install that .tgz file
yarn add /tmp/angular-components-examples-0.0.0.tgz

We should probably make a script that does this more easily (cc @devversion )

0reactions
angular-automatic-lock-bot[bot]commented, Sep 5, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cdk virtual scrolling issue - angular - Stack Overflow
First you need the Viewport Reference: @ViewChild(CdkVirtualScrollViewport, {static: false}) cdkVirtualScrollViewport: CdkVirtualScrollViewport;.
Read more >
Virtualize large lists with the Angular CDK - web.dev
Learn how to make large lists more responsive by implementing virtual scrolling with the Angular Component Dev Kit.
Read more >
Virtual Scroll | Ionic Documentation
When we want to use the CDK Scroller, we'll need to import the module in our ... cdk-virtual-scroll-viewport becomes the root of our...
Read more >
Angular Cdk Demo Virtual Scroll (forked) - StackBlitz
Demonstrate Virtual Scrolling for @angular/cdk. ... import { CdkVirtualScrollViewport } from ... loading$ = new BehaviorSubject(false);. constructor(){.
Read more >
ng-table-virtual-scroll-bug - npm
Start using ng-table-virtual-scroll-bug in your project by running `npm ... <cdk-virtual-scroll-viewport tvsItemSize="48" headerHeight="56" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found