Skip to content

Instantly share code, notes, and snippets.

@wilsaantos
Created July 4, 2024 17:20
Show Gist options
  • Save wilsaantos/5dde5a227c2ba17d7ccb0b910c756a3f to your computer and use it in GitHub Desktop.
Save wilsaantos/5dde5a227c2ba17d7ccb0b910c756a3f to your computer and use it in GitHub Desktop.
Angular Material Paginator Intl pt-BR
import { MatPaginatorIntl } from '@angular/material/paginator';
export class MatPaginatorIntlCustom extends MatPaginatorIntl {
override itemsPerPageLabel = 'Itens por páginas';
override nextPageLabel = 'Próxima';
override previousPageLabel = 'Anterior';
override firstPageLabel = 'Primeira página';
override lastPageLabel = 'Última página';
// tslint:disable-next-line:only-arrow-functions
override getRangeLabel = (page: number, pageSize: number, length: number) => {
if (length === 0 || pageSize === 0) {
return `0 of ${length}`;
}
length = Math.max(length, 0);
const startIndex = page * pageSize;
const endIndex =
startIndex < length
? Math.min(startIndex + pageSize, length)
: startIndex + pageSize;
const label = `${startIndex + 1} - ${endIndex} de ${length}`;
return label;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment