Skip to content

Commit c2c7f44

Browse files
authored
docs(tooltip): scrollable example not working (#18661)
Fixes the example that shows how a tooltip works with a `CdkScrollable` not working, because we hadn't imported the module. Also fixes a few places that were using the old way of writing the selector.
1 parent 400901b commit c2c7f44

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/cdk/scrolling/scroll-dispatcher.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ describe('ScrollDispatcher', () => {
241241

242242
/** Simple component that contains a large div and can be scrolled. */
243243
@Component({
244-
template: `<div #scrollingElement cdk-scrollable style="height: 9999px"></div>`
244+
template: `<div #scrollingElement cdkScrollable style="height: 9999px"></div>`
245245
})
246246
class ScrollingComponent {
247247
@ViewChild(CdkScrollable) scrollable: CdkScrollable;
@@ -252,13 +252,13 @@ class ScrollingComponent {
252252
/** Component containing nested scrollables. */
253253
@Component({
254254
template: `
255-
<div id="scrollable-1" cdk-scrollable>
256-
<div id="scrollable-1a" cdk-scrollable>
255+
<div id="scrollable-1" cdkScrollable>
256+
<div id="scrollable-1a" cdkScrollable>
257257
<div #interestingElement></div>
258258
</div>
259-
<div id="scrollable-1b" cdk-scrollable></div>
259+
<div id="scrollable-1b" cdkScrollable></div>
260260
</div>
261-
<div id="scrollable-2" cdk-scrollable></div>
261+
<div id="scrollable-2" cdkScrollable></div>
262262
`
263263
})
264264
class NestedScrollingComponent {

src/components-examples/material/tooltip/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ng_module(
1111
]),
1212
module_name = "@angular/components-examples/material/tooltip",
1313
deps = [
14+
"//src/cdk/scrolling",
1415
"//src/material/button",
1516
"//src/material/checkbox",
1617
"//src/material/input",

src/components-examples/material/tooltip/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {CommonModule} from '@angular/common';
22
import {NgModule} from '@angular/core';
33
import {ReactiveFormsModule} from '@angular/forms';
4+
import {ScrollingModule} from '@angular/cdk/scrolling';
45
import {MatButtonModule} from '@angular/material/button';
56
import {MatCheckboxModule} from '@angular/material/checkbox';
67
import {MatInputModule} from '@angular/material/input';
@@ -51,6 +52,7 @@ const EXAMPLES = [
5152
MatSelectModule,
5253
MatTooltipModule,
5354
ReactiveFormsModule,
55+
ScrollingModule, // Required for the auto-scrolling example
5456
],
5557
declarations: EXAMPLES,
5658
exports: EXAMPLES,

src/components-examples/material/tooltip/tooltip-auto-hide/tooltip-auto-hide-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</mat-select>
88
</mat-form-field>
99

10-
<div class="example-container" cdk-scrollable>
10+
<div class="example-container" cdkScrollable>
1111
<button mat-raised-button #tooltip="matTooltip"
1212
matTooltip="Info about the action"
1313
[matTooltipPosition]="position.value"

src/material/tooltip/tooltip.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ class BasicTooltipDemo {
11161116
@Component({
11171117
selector: 'app',
11181118
template: `
1119-
<div cdk-scrollable style="padding: 100px; margin: 300px;
1119+
<div cdkScrollable style="padding: 100px; margin: 300px;
11201120
height: 200px; width: 200px; overflow: auto;">
11211121
<button *ngIf="showButton" style="margin-bottom: 600px"
11221122
[matTooltip]="message"

0 commit comments

Comments
 (0)