@@ -11,6 +11,7 @@ import {coerceNumberProperty} from '@angular/cdk/coercion';
1111import { CollectionViewer , DataSource , isDataSource , SelectionModel } from '@angular/cdk/collections' ;
1212import {
1313 AfterContentChecked ,
14+ AfterContentInit ,
1415 ChangeDetectionStrategy ,
1516 ChangeDetectorRef ,
1617 Component ,
@@ -100,7 +101,9 @@ function isNotNullish<T>(val: T | null | undefined): val is T {
100101 // tslint:disable-next-line:validate-decorators
101102 changeDetection : ChangeDetectionStrategy . Default ,
102103} )
103- export class CdkTree < T , K = T > implements AfterContentChecked , CollectionViewer , OnDestroy , OnInit {
104+ export class CdkTree < T , K = T >
105+ implements AfterContentChecked , AfterContentInit , CollectionViewer , OnDestroy , OnInit
106+ {
104107 /** Subject that emits when the component has been destroyed. */
105108 private readonly _onDestroy = new Subject < void > ( ) ;
106109
@@ -704,8 +707,7 @@ export class CdkTree<T, K = T> implements AfterContentChecked, CollectionViewer,
704707
705708 /** Given a CdkTreeNode, gets the nodes that renders that node's child data. */
706709 _getNodeChildren ( node : CdkTreeNode < T , K > ) {
707- const children = coerceObservable ( this . _getChildrenAccessor ( ) ?.( node . data ) ?? [ ] ) ;
708- return children . pipe (
710+ return coerceObservable ( this . _getChildrenAccessor ( ) ?.( node . data ) ?? [ ] ) . pipe (
709711 map ( children =>
710712 children
711713 . map ( child => this . _nodes . value . get ( this . _getExpansionKey ( child ) ) )
@@ -1015,7 +1017,7 @@ export class CdkTreeNode<T, K = T> implements OnDestroy, OnInit, TreeKeyManagerI
10151017 return this . _tree . _getNodeParent ( this ) ?? null ;
10161018 }
10171019
1018- getChildren ( ) : Array < CdkTreeNode < T , K > > | Observable < Array < CdkTreeNode < T , K > > > {
1020+ getChildren ( ) : CdkTreeNode < T , K > [ ] | Observable < CdkTreeNode < T , K > [ ] > {
10191021 return this . _tree . _getNodeChildren ( this ) ;
10201022 }
10211023
0 commit comments