Enhanced the Collapse all or Expand All button by implementing both in the same button and also fix the translation for both
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
d846a8068f
commit
8ac82cc6a6
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NestedTreeControl } from '@angular/cdk/tree';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TreeControlService {
|
||||
constructor() { }
|
||||
|
||||
toggleExpandCollapse(nestedTreeControl: NestedTreeControl<any>, isTreeExpanded: boolean) {
|
||||
if (isTreeExpanded) {
|
||||
nestedTreeControl.collapseAll();
|
||||
} else {
|
||||
nestedTreeControl.expandAll();
|
||||
}
|
||||
// Toggle the state
|
||||
return !isTreeExpanded;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user