fix(stepper): intl provider not being picked up in lazy-loaded modules (#12934)

This commit is contained in:
Kristiyan Kostadinov
2018-10-19 17:02:06 +02:00
committed by Joey Perrott
parent 861642c048
commit 675aa66b6f
2 changed files with 16 additions and 3 deletions
+14 -1
View File
@@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Injectable} from '@angular/core';
import {Injectable, Optional, SkipSelf} from '@angular/core';
import {Subject} from 'rxjs';
@@ -22,3 +22,16 @@ export class MatStepperIntl {
/** Label that is rendered below optional steps. */
optionalLabel: string = 'Optional';
}
/** @docs-private */
export function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl: MatStepperIntl) {
return parentIntl || new MatStepperIntl();
}
/** @docs-private */
export const MAT_STEPPER_INTL_PROVIDER = {
provide: MatStepperIntl,
deps: [[new Optional(), new SkipSelf(), MatStepperIntl]],
useFactory: MAT_STEPPER_INTL_PROVIDER_FACTORY
};
+2 -2
View File
@@ -18,7 +18,7 @@ import {MatStepLabel} from './step-label';
import {MatHorizontalStepper, MatStep, MatStepper, MatVerticalStepper} from './stepper';
import {MatStepperNext, MatStepperPrevious} from './stepper-button';
import {MatStepperIcon} from './stepper-icon';
import {MatStepperIntl} from './stepper-intl';
import {MAT_STEPPER_INTL_PROVIDER} from './stepper-intl';
@NgModule({
@@ -54,6 +54,6 @@ import {MatStepperIntl} from './stepper-intl';
MatStepHeader,
MatStepperIcon,
],
providers: [MatStepperIntl, ErrorStateMatcher],
providers: [MAT_STEPPER_INTL_PROVIDER, ErrorStateMatcher],
})
export class MatStepperModule {}