-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(stepper): intl provider not being picked up in lazy-loaded modules #12934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}) | ||
export class MatStepperModule {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want to do this; it makes it impossible to re-provide the intl config for a subset of the app. I would have thought that including the
provide:
for the custom implementation in the lazy-loaded module would bring in the customization.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like that's the case, based on our discussion in the issue. FWIW we do the same as here for the sort header and paginator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the issue it said that they were providing their custom intl implementation in the root module and not in the lazy-loaded module, which I think is the problem. Using
providedIn
isn't an option here because they have to re-provide the existing token.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That means that they'd have to remember to add the provider for each new lazy-loaded module that is introduced. I don't think that a translation provider is something you'd generally want to be able to re-provide for different sections of the app. Also if we went with the
providedIn
approach, how would we handle the other similar providers that already use the old approach?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow what you mean in the second part about
providedIn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that if we went with the approach that is currently in master (having a
providedIn
and having people provide it themselves in the lazy-loaded modules), it makes the stepper's i18n provider inconsistent with the other i18n providers (like sort header or paginator) which are provided in the same way as this PR.