refactor(tree): use destroy cleanup logic from base class (#10740)

Uses the `ngOnDestroy` logic from the `CdkTreeNode` rather than re-implementing it in the `CdkNestedTreeNode`. This is less prone to errors in the future, if we decide to introduce more cleanup logic inside the base class.
This commit is contained in:
Kristiyan Kostadinov
2018-04-11 19:31:04 +02:00
committed by tinayuangao
parent f023579879
commit 718cee012e
+2 -3
View File
@@ -79,13 +79,12 @@ export class CdkNestedTreeNode<T> extends CdkTreeNode<T> implements AfterContent
this.updateChildrenNodes();
});
this.nodeOutlet.changes.pipe(takeUntil(this._destroyed))
.subscribe((_) => this.updateChildrenNodes());
.subscribe(() => this.updateChildrenNodes());
}
ngOnDestroy() {
this._clear();
this._destroyed.next();
this._destroyed.complete();
super.ngOnDestroy();
}
/** Add children dataNodes to the NodeOutlet */