Skip to content

Commit 416c64e

Browse files
committed
refactor(material/paginator): use ID generator
Switches to using the ID generator service to create unique IDs.
1 parent ea0aed5 commit 416c64e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/material/paginator/paginator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import {
2020
Output,
2121
ViewEncapsulation,
2222
booleanAttribute,
23+
inject,
2324
numberAttribute,
2425
} from '@angular/core';
26+
import {_IdGenerator} from '@angular/cdk/a11y';
2527
import {MatOption, ThemePalette} from '@angular/material/core';
2628
import {MatSelect} from '@angular/material/select';
2729
import {MatIconButton} from '@angular/material/button';
@@ -90,8 +92,6 @@ export const MAT_PAGINATOR_DEFAULT_OPTIONS = new InjectionToken<MatPaginatorDefa
9092
'MAT_PAGINATOR_DEFAULT_OPTIONS',
9193
);
9294

93-
let nextUniqueId = 0;
94-
9595
/**
9696
* Component to provide navigation between paged information. Displays the size of the current
9797
* page, user-selectable options to change that size, what items are being shown, and
@@ -115,7 +115,7 @@ export class MatPaginator implements OnInit, OnDestroy {
115115
_formFieldAppearance?: MatFormFieldAppearance;
116116

117117
/** ID for the DOM node containing the paginator's items per page label. */
118-
readonly _pageSizeLabelId = `mat-paginator-page-size-label-${nextUniqueId++}`;
118+
readonly _pageSizeLabelId = inject(_IdGenerator).getId('mat-paginator-page-size-label-');
119119

120120
private _intlChanges: Subscription;
121121
private _isInitialized = false;

0 commit comments

Comments
 (0)