Skip to content

Commit

Permalink
refactor(material/timepicker): use ID generator
Browse files Browse the repository at this point in the history
Switches to using the ID generator service to create unique IDs.

(cherry picked from commit a13699e)
  • Loading branch information
crisbeto committed Nov 4, 2024
1 parent 20f5157 commit dd1084e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/material/timepicker/timepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {Overlay, OverlayRef} from '@angular/cdk/overlay';
import {TemplatePortal} from '@angular/cdk/portal';
import {_getEventTarget} from '@angular/cdk/platform';
import {ENTER, ESCAPE, hasModifierKey, TAB} from '@angular/cdk/keycodes';
import {ActiveDescendantKeyManager} from '@angular/cdk/a11y';
import {_IdGenerator, ActiveDescendantKeyManager} from '@angular/cdk/a11y';
import type {MatTimepickerInput} from './timepicker-input';
import {
generateOptions,
Expand All @@ -55,9 +55,6 @@ import {
} from './util';
import {Subscription} from 'rxjs';

/** Counter used to generate unique IDs. */
let uniqueId = 0;

/** Event emitted when a value is selected in the timepicker. */
export interface MatTimepickerSelected<D> {
value: D;
Expand Down Expand Up @@ -157,7 +154,7 @@ export class MatTimepicker<D> implements OnDestroy, MatOptionParentComponent {
readonly activeDescendant: Signal<string | null> = this._activeDescendant.asReadonly();

/** Unique ID of the timepicker's panel */
readonly panelId = `mat-timepicker-panel-${uniqueId++}`;
readonly panelId: string = inject(_IdGenerator).getId('mat-timepicker-panel-');

/** Whether ripples within the timepicker should be disabled. */
readonly disableRipple: InputSignalWithTransform<boolean, unknown> = input(
Expand Down

0 comments on commit dd1084e

Please sign in to comment.