Skip to content

fix(MatPaginatorIntl): Provide a provider if exists. #7895

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 3 commits into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/paginator/paginator-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class MatPaginatorIntl {
}

/** @docs-private */
export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(
export function parentIntl(
Copy link
Member

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();
}

Copy link
Contributor Author

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?

Copy link
Contributor Author

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

parentMatPaginatorIntl: MatPaginatorIntl) {
return parentMatPaginatorIntl || new MatPaginatorIntl();
}
Expand All @@ -58,5 +58,5 @@ export const MAT_PAGINATOR_INTL_PROVIDER = {
// If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
provide: MatPaginatorIntl,
deps: [[new Optional(), new SkipSelf(), MatPaginatorIntl]],
useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY
useFactory: parentIntl
};
2 changes: 1 addition & 1 deletion src/lib/paginator/paginator-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 { MAT_PAGINATOR_INTL_PROVIDER} from './paginator-intl';
import {MAT_PAGINATOR_INTL_PROVIDER} from './paginator-intl';


@NgModule({
Expand Down