Skip to content

Commit a5466de

Browse files
committed
refactor(listbox): used lightweight injection token for CdkComboboxPanel inside listbox.
1 parent 96e7729 commit a5466de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cdk-experimental/listbox/listbox.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
ContentChildren,
1212
Directive,
1313
ElementRef, EventEmitter, forwardRef,
14-
Inject,
14+
Inject, InjectionToken,
1515
Input, OnDestroy, OnInit, Optional, Output,
1616
QueryList
1717
} from '@angular/core';
@@ -33,6 +33,8 @@ export const CDK_LISTBOX_VALUE_ACCESSOR: any = {
3333
multi: true
3434
};
3535

36+
export const PANEL = new InjectionToken<CdkComboboxPanel>('CdkComboboxPanel');
37+
3638
@Directive({
3739
selector: '[cdkOption]',
3840
exportAs: 'cdkOption',
@@ -271,7 +273,7 @@ export class CdkListbox<T> implements AfterContentInit, OnDestroy, OnInit, Contr
271273
@Input('parentPanel') private readonly _explicitPanel: CdkComboboxPanel;
272274

273275
constructor(
274-
@Optional() readonly _parentPanel?: CdkComboboxPanel<T>,
276+
@Optional() @Inject(PANEL) readonly _parentPanel?: CdkComboboxPanel<T>,
275277
) { }
276278

277279
ngOnInit() {

0 commit comments

Comments
 (0)