Skip to content

Instantly share code, notes, and snippets.

@ZhenDeng
Created January 16, 2020 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZhenDeng/37d02f959470b640abd9eda0dfaacc72 to your computer and use it in GitHub Desktop.
Save ZhenDeng/37d02f959470b640abd9eda0dfaacc72 to your computer and use it in GitHub Desktop.
Using create custom MatSortHeaderIntl intance to modify the labels and text displayed as an example
*** In app module providers
{ provide: MatSortHeaderIntl, useClass: CustomMatSortHeaderIntl }
*** custom-mat-sort-header-intl.ts
create custom-mat-sort-header-intl.ts and in the file:
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/internal/Subject';
@Injectable()
export class CustomMatSortHeaderIntl{
changes: Subject<void> = new Subject<void>();
sortButtonLabel(id: string) { return `${id} sorting`;};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment