@@ -34,7 +34,7 @@ import {
3434 ViewChild ,
3535 ViewEncapsulation ,
3636} from '@angular/core' ;
37- import { Observable , of as obaservableOf , Subject } from 'rxjs' ;
37+ import { Observable , of as observableOf , Subject } from 'rxjs' ;
3838import { startWith , takeUntil } from 'rxjs/operators' ;
3939
4040import { CdkStepHeader } from './step-header' ;
@@ -124,7 +124,7 @@ export class CdkStep implements OnChanges {
124124 @ViewChild ( TemplateRef , { static : true } ) content : TemplateRef < any > ;
125125
126126 /** The top level abstract control of the step. */
127- @Input ( ) stepControl : FormControlLike ;
127+ @Input ( ) stepControl : AbstractControlLike ;
128128
129129 /** Whether user has seen the expanded step content or not. */
130130 interacted = false ;
@@ -257,6 +257,12 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
257257 */
258258 @ContentChildren ( CdkStep ) _steps : QueryList < CdkStep > ;
259259
260+ /**
261+ * We need to store the steps in an Iterable due to strict template type checking with *ngFor and
262+ * https://github.com/angular/angular/issues/29842.
263+ */
264+ _stepsArray : CdkStep [ ] = [ ] ;
265+
260266 /** The list of step components that the stepper is holding. */
261267 get steps ( ) : QueryList < CdkStep > {
262268 return this . _steps ;
@@ -332,13 +338,13 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
332338
333339 ngAfterViewInit ( ) {
334340 // Note that while the step headers are content children by default, any components that
335- // extend this one might have them as view chidren . We initialize the keyboard handling in
341+ // extend this one might have them as view children . We initialize the keyboard handling in
336342 // AfterViewInit so we're guaranteed for both view and content children to be defined.
337343 this . _keyManager = new FocusKeyManager < FocusableOption > ( this . _stepHeader )
338344 . withWrap ( )
339345 . withVerticalOrientation ( this . _orientation === 'vertical' ) ;
340346
341- ( this . _dir ? ( this . _dir . change as Observable < Direction > ) : obaservableOf < Direction > ( ) )
347+ ( this . _dir ? ( this . _dir . change as Observable < Direction > ) : observableOf < Direction > ( ) )
342348 . pipe ( startWith ( this . _layoutDirection ( ) ) , takeUntil ( this . _destroyed ) )
343349 . subscribe ( direction => this . _keyManager . withHorizontalOrientation ( direction ) ) ;
344350
@@ -517,12 +523,12 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
517523
518524
519525/**
520- * Simplified representation of a FormControl from @angular/forms.
526+ * Simplified representation of an "AbstractControl" from @angular/forms.
521527 * Used to avoid having to bring in @angular/forms for a single optional interface.
522528 * @docs -private
523529 */
524- interface FormControlLike {
525- asyncValidator : ( ) => any | null ;
530+ interface AbstractControlLike {
531+ asyncValidator : ( ( control : any ) => any ) | null ;
526532 dirty : boolean ;
527533 disabled : boolean ;
528534 enabled : boolean ;
@@ -531,21 +537,21 @@ interface FormControlLike {
531537 parent : any ;
532538 pending : boolean ;
533539 pristine : boolean ;
534- root : FormControlLike ;
540+ root : AbstractControlLike ;
535541 status : string ;
536542 statusChanges : Observable < any > ;
537543 touched : boolean ;
538544 untouched : boolean ;
539545 updateOn : any ;
540546 valid : boolean ;
541- validator : ( ) => any | null ;
547+ validator : ( ( control : any ) => any ) | null ;
542548 value : any ;
543549 valueChanges : Observable < any > ;
544550 clearAsyncValidators ( ) : void ;
545551 clearValidators ( ) : void ;
546552 disable ( opts ?: any ) : void ;
547553 enable ( opts ?: any ) : void ;
548- get ( path : ( string | number ) [ ] | string ) : FormControlLike | null ;
554+ get ( path : ( string | number ) [ ] | string ) : AbstractControlLike | null ;
549555 getError ( errorCode : string , path ?: ( string | number ) [ ] | string ) : any ;
550556 hasError ( errorCode : string , path ?: ( string | number ) [ ] | string ) : boolean ;
551557 markAllAsTouched ( ) : void ;
@@ -556,15 +562,15 @@ interface FormControlLike {
556562 markAsUntouched ( opts ?: any ) : void ;
557563 patchValue ( value : any , options ?: Object ) : void ;
558564 reset ( value ?: any , options ?: Object ) : void ;
559- setAsyncValidators ( newValidator : ( ) => any | ( ( ) => any ) [ ] | null ) : void ;
565+ setAsyncValidators ( newValidator : ( control : any ) => any |
566+ ( ( control : any ) => any ) [ ] | null ) : void ;
560567 setErrors ( errors : { [ key : string ] : any } | null , opts ?: any ) : void ;
561568 setParent ( parent : any ) : void ;
562- setValidators ( newValidator : ( ) => any | ( ( ) => any ) [ ] | null ) : void ;
569+ setValidators ( newValidator : ( control : any ) => any |
570+ ( ( control : any ) => any ) [ ] | null ) : void ;
563571 setValue ( value : any , options ?: Object ) : void ;
564572 updateValueAndValidity ( opts ?: any ) : void ;
565573 patchValue ( value : any , options ?: any ) : void ;
566- registerOnChange ( fn : Function ) : void ;
567- registerOnDisabledChange ( fn : ( isDisabled : boolean ) => void ) : void ;
568574 reset ( formState ?: any , options ?: any ) : void ;
569575 setValue ( value : any , options ?: any ) : void ;
570576}
0 commit comments