@@ -24,7 +24,9 @@ import {
2424 ViewEncapsulation ,
2525 Optional ,
2626 Inject ,
27- forwardRef
27+ forwardRef ,
28+ ChangeDetectionStrategy ,
29+ ChangeDetectorRef ,
2830} from '@angular/core' ;
2931import { LEFT_ARROW , RIGHT_ARROW , ENTER , SPACE } from '@angular/cdk/keycodes' ;
3032import { CdkStepLabel } from './step-label' ;
@@ -60,7 +62,8 @@ export class StepperSelectionEvent {
6062 moduleId : module . id ,
6163 selector : 'cdk-step' ,
6264 templateUrl : 'step.html' ,
63- encapsulation : ViewEncapsulation . None
65+ encapsulation : ViewEncapsulation . None ,
66+ changeDetection : ChangeDetectionStrategy . OnPush ,
6467} )
6568export class CdkStep {
6669 /** Template for step label if it exists. */
@@ -72,12 +75,11 @@ export class CdkStep {
7275 /** The top level abstract control of the step. */
7376 @Input ( ) stepControl : AbstractControl ;
7477
75- /** Whether user has seen the expanded step content or not . */
78+ /** Whether user has seen the expanded step content or not. */
7679 interacted = false ;
7780
7881 /** Label of the step. */
79- @Input ( )
80- label : string ;
82+ @Input ( ) label : string ;
8183
8284 @Input ( )
8385 get editable ( ) { return this . _editable ; }
@@ -163,7 +165,9 @@ export class CdkStepper {
163165 /** Used to track unique ID for each stepper component. */
164166 _groupId : number ;
165167
166- constructor ( @Optional ( ) private _dir : Directionality ) {
168+ constructor (
169+ @Optional ( ) private _dir : Directionality ,
170+ private _changeDetectorRef : ChangeDetectorRef ) {
167171 this . _groupId = nextId ++ ;
168172 }
169173
@@ -217,6 +221,7 @@ export class CdkStepper {
217221 previouslySelectedStep : stepsArray [ this . _selectedIndex ] ,
218222 } ) ;
219223 this . _selectedIndex = newIndex ;
224+ this . _changeDetectorRef . markForCheck ( ) ;
220225 }
221226
222227 _onKeydown ( event : KeyboardEvent ) {
0 commit comments