@@ -19,6 +19,7 @@ import {
19
19
inject ,
20
20
} from '@angular/core' ;
21
21
import { Directionality } from '@angular/cdk/bidi' ;
22
+ import { _IdGenerator } from '@angular/cdk/a11y' ;
22
23
import { ScrollDispatcher } from '@angular/cdk/scrolling' ;
23
24
import { CDK_DROP_LIST , CdkDrag } from './drag' ;
24
25
import { CdkDragDrop , CdkDragEnter , CdkDragExit , CdkDragSortEvent } from '../drag-events' ;
@@ -31,9 +32,6 @@ import {merge, Subject} from 'rxjs';
31
32
import { startWith , takeUntil } from 'rxjs/operators' ;
32
33
import { assertElementNode } from './assertions' ;
33
34
34
- /** Counter used to generate unique ids for drop zones. */
35
- let _uniqueIdCounter = 0 ;
36
-
37
35
/** Container that wraps a set of draggable items. */
38
36
@Directive ( {
39
37
selector : '[cdkDropList], cdk-drop-list' ,
@@ -91,7 +89,7 @@ export class CdkDropList<T = any> implements OnDestroy {
91
89
* Unique ID for the drop zone. Can be used as a reference
92
90
* in the `connectedTo` of another `CdkDropList`.
93
91
*/
94
- @Input ( ) id : string = ` cdk-drop-list-${ _uniqueIdCounter ++ } ` ;
92
+ @Input ( ) id : string = inject ( _IdGenerator ) . getId ( ' cdk-drop-list-' ) ;
95
93
96
94
/** Locks the position of the draggable elements inside the container along the specified axis. */
97
95
@Input ( 'cdkDropListLockAxis' ) lockAxis : DragAxis ;
0 commit comments