|
6 | 6 | * found in the LICENSE file at https://angular.dev/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y'; |
| 9 | +import {_IdGenerator, FocusMonitor, FocusOrigin} from '@angular/cdk/a11y'; |
10 | 10 | import {UniqueSelectionDispatcher} from '@angular/cdk/collections';
|
11 | 11 | import {
|
12 | 12 | ANIMATION_MODULE_TYPE,
|
@@ -47,9 +47,6 @@ import {
|
47 | 47 | import {Subscription} from 'rxjs';
|
48 | 48 | import {_CdkPrivateStyleLoader} from '@angular/cdk/private';
|
49 | 49 |
|
50 |
| -// Increasing integer for generating unique ids for radio components. |
51 |
| -let nextUniqueId = 0; |
52 |
| - |
53 | 50 | /** Change event object emitted by radio button and radio group. */
|
54 | 51 | export class MatRadioChange {
|
55 | 52 | constructor(
|
@@ -129,7 +126,7 @@ export class MatRadioGroup implements AfterContentInit, OnDestroy, ControlValueA
|
129 | 126 | private _value: any = null;
|
130 | 127 |
|
131 | 128 | /** The HTML name attribute applied to radio buttons in this group. */
|
132 |
| - private _name: string = `mat-radio-group-${nextUniqueId++}`; |
| 129 | + private _name: string = inject(_IdGenerator).getId('mat-radio-group-'); |
133 | 130 |
|
134 | 131 | /** The currently selected radio button. Should match value. */
|
135 | 132 | private _selected: MatRadioButton | null = null;
|
@@ -422,7 +419,7 @@ export class MatRadioButton implements OnInit, AfterViewInit, DoCheck, OnDestroy
|
422 | 419 | });
|
423 | 420 |
|
424 | 421 | private _ngZone = inject(NgZone);
|
425 |
| - private _uniqueId: string = `mat-radio-${++nextUniqueId}`; |
| 422 | + private _uniqueId: string = inject(_IdGenerator).getId('mat-radio-'); |
426 | 423 |
|
427 | 424 | /** The unique ID for the radio button. */
|
428 | 425 | @Input() id: string = this._uniqueId;
|
|
0 commit comments