File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 1+ import { FocusKeyManager } from '@angular/cdk/a11y' ;
12import {
23 AfterContentInit ,
34 booleanAttribute ,
45 computed ,
5- ContentChildren ,
6+ contentChildren ,
67 DestroyRef ,
78 Directive ,
89 ElementRef ,
910 forwardRef ,
1011 inject ,
1112 input ,
1213 linkedSignal ,
13- OnInit ,
14- QueryList
14+ OnInit
1515} from '@angular/core' ;
16- import { FocusKeyManager } from '@angular/cdk/a11y' ;
17- import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
16+ import { takeUntilDestroyed , toObservable } from '@angular/core/rxjs-interop' ;
1817import { tap } from 'rxjs/operators' ;
1918
2019import { ThemeDirective } from '../../shared/theme.directive' ;
@@ -98,13 +97,17 @@ export class DropdownMenuDirective implements OnInit, AfterContentInit {
9897 }
9998 }
10099
101- @ContentChildren ( forwardRef ( ( ) => DropdownItemDirective ) , { descendants : true } )
102- dropdownItemsContent ! : QueryList < DropdownItemDirective > ;
100+ readonly dropdownItemsContent = contentChildren < DropdownItemDirective > (
101+ forwardRef ( ( ) => DropdownItemDirective ) ,
102+ { descendants : true }
103+ ) ;
104+
105+ readonly items$ = toObservable ( this . dropdownItemsContent ) ;
103106
104107 ngAfterContentInit ( ) : void {
105108 this . focusKeyManagerInit ( ) ;
106109
107- this . dropdownItemsContent . changes
110+ this . items$
108111 . pipe (
109112 tap ( ( change ) => {
110113 this . focusKeyManagerInit ( ) ;
@@ -131,7 +134,7 @@ export class DropdownMenuDirective implements OnInit, AfterContentInit {
131134 }
132135
133136 private focusKeyManagerInit ( ) : void {
134- this . #focusKeyManager = new FocusKeyManager ( this . dropdownItemsContent )
137+ this . #focusKeyManager = new FocusKeyManager ( this . dropdownItemsContent ( ) )
135138 . withHomeAndEnd ( )
136139 . withPageUpDown ( )
137140 . withWrap ( )
You can’t perform that action at this time.
0 commit comments