Skip to content

Commit 2a50a47

Browse files
nielsr98mmalerba
authored andcommitted
docs(cdk/stepper): refactor example for consistency with other examples
(angular#20383)
1 parent 9d71d17 commit 2a50a47

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export class CdkCustomStepperWithoutFormExample {}
1414
selector: 'example-custom-stepper',
1515
templateUrl: './example-custom-stepper.html',
1616
styleUrls: ['./example-custom-stepper.css'],
17-
providers: [{ provide: CdkStepper, useExisting: CustomStepper }]
17+
providers: [{provide: CdkStepper, useExisting: CustomStepper}]
1818
})
1919
export class CustomStepper extends CdkStepper {
20-
onClick(index: number): void {
20+
selectStepByIndex(index: number): void {
2121
this.selectedIndex = index;
2222
}
2323
}

src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/example-custom-stepper.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
<h2>Step {{ selectedIndex + 1 }}/{{ steps.length }}</h2>
44
</header>
55

6-
<div [style.display]="selected ? 'block' : 'none'">
7-
<ng-container [ngTemplateOutlet]="selected.content"></ng-container>
8-
</div>
6+
<div [ngTemplateOutlet]="selected ? selected.content : null"></div>
97

108
<footer class="example-step-navigation-bar">
119
<button class="example-nav-button" cdkStepperPrevious>&larr;</button>
1210
<button
1311
class="example-step"
12+
[class.example-active]="selectedIndex === i"
1413
*ngFor="let step of steps; let i = index"
15-
[ngClass]="{ 'example-active': selectedIndex === i }"
16-
(click)="onClick(i)"
14+
(click)="selectStepByIndex(i)"
1715
>
1816
Step {{ i + 1 }}
1917
</button>

0 commit comments

Comments
 (0)