File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
src/material/autocomplete Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -33,17 +33,11 @@ import {
3333 MatOption ,
3434 ThemePalette ,
3535} from '@angular/material/core' ;
36- import { ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
36+ import { _IdGenerator , ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
3737import { Platform } from '@angular/cdk/platform' ;
3838import { panelAnimation } from './animations' ;
3939import { Subscription } from 'rxjs' ;
4040
41- /**
42- * Autocomplete IDs need to be unique across components, so this counter exists outside of
43- * the component definition.
44- */
45- let _uniqueAutocompleteIdCounter = 0 ;
46-
4741/** Event object that is emitted when an autocomplete option is selected. */
4842export class MatAutocompleteSelectedEvent {
4943 constructor (
@@ -247,7 +241,7 @@ export class MatAutocomplete implements AfterContentInit, OnDestroy {
247241 }
248242
249243 /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
250- id : string = ` mat-autocomplete-${ _uniqueAutocompleteIdCounter ++ } ` ;
244+ id : string = inject ( _IdGenerator ) . getId ( ' mat-autocomplete-' ) ;
251245
252246 /**
253247 * Tells any descendant `mat-optgroup` to use the inert a11y pattern.
You can’t perform that action at this time.
0 commit comments