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 {
33
33
MatOption ,
34
34
ThemePalette ,
35
35
} from '@angular/material/core' ;
36
- import { ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
36
+ import { _IdGenerator , ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
37
37
import { Platform } from '@angular/cdk/platform' ;
38
38
import { panelAnimation } from './animations' ;
39
39
import { Subscription } from 'rxjs' ;
40
40
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
-
47
41
/** Event object that is emitted when an autocomplete option is selected. */
48
42
export class MatAutocompleteSelectedEvent {
49
43
constructor (
@@ -247,7 +241,7 @@ export class MatAutocomplete implements AfterContentInit, OnDestroy {
247
241
}
248
242
249
243
/** 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-' ) ;
251
245
252
246
/**
253
247
* Tells any descendant `mat-optgroup` to use the inert a11y pattern.
You can’t perform that action at this time.
0 commit comments