-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix(MatPaginatorIntl): Provide a provider if exists. #7895
Conversation
If there is already a MatPaginatorIntl provider that one If not create a new instance. Closes angular#7344
@andrewseguin the screenshot test failed but it looks like it is different because of the focus on the input. Don't know if I did this but I don't see how. |
@andrewseguin or @jelbourn, Any idea when this pr will be reviewed? Happy to change things of needed. |
src/lib/paginator/paginator-intl.ts
Outdated
@@ -46,3 +46,17 @@ export class MatPaginatorIntl { | |||
return `${startIndex + 1} - ${endIndex} of ${length}`; | |||
} | |||
} | |||
|
|||
/** @docs-private */ | |||
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY( |
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.
You can just call the arg parentIntl
@@ -12,7 +12,7 @@ import {MatButtonModule} from '@angular/material/button'; | |||
import {MatSelectModule} from '@angular/material/select'; | |||
import {MatTooltipModule} from '@angular/material/tooltip'; | |||
import {MatPaginator} from './paginator'; | |||
import {MatPaginatorIntl} from './paginator-intl'; | |||
import { MAT_PAGINATOR_INTL_PROVIDER} from './paginator-intl'; |
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.
Omit space at beginning of import
@jelbourn just pushed a new commit with I believe the requested changes. |
src/lib/paginator/paginator-intl.ts
Outdated
@@ -48,7 +48,7 @@ export class MatPaginatorIntl { | |||
} | |||
|
|||
/** @docs-private */ | |||
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY( | |||
export function parentIntl( |
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.
Sorry, I wasn't totally clear. I meant the argument to the function (so that it fits on one line):
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl: MatPaginatorIntl) {
return parentMatPaginatorIntl || new MatPaginatorIntl();
}
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.
okay, will make the change, just to be sure with parentMatPaginatorIntl
you mean the parentIntl
argument correct?
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.
Also did you see my first comment, should pattern also be implemented for the sort-header-intl
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.
LGTM
Feel free to send a similar PR for sorting |
Along the same lines as angular#7988 and angular#7895. Fixes the consumer-provided `MatStepperIntl` instance not being picked up inside lazy-loaded modules. Fixes angular#12904.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
If there is already a MatPaginatorIntl provider that one. If not create a new instance.
@andrewseguin I hope this is the correct implementation. If not let me know I will change it.
Next to this shouldn't this also be implemented for
sort-header-intl
cc: @jelbourn
Closes #7344