В шаблоне вы можете использовать ' itemTemplate '
<ngx-treeview [config]="config" (selectedChange)="selectItem()" [items]="Items" [itemTemplate]="itemTemplate">
Внизу ниже вашего шаблона добавьте ng-template
<ng-template #itemTemplate let-item="item" let-onCollapseExpand="onCollapseExpand" let-onCheckedChange="onCheckedChange">
<div class="form-inline row-item">
<i *ngIf="item.children" (click)="onCollapseExpand()" aria-hidden="true" class="fa" [class.fa-caret-right]="item.collapsed" class.fa-caret-down]="!item.collapsed"></i>
<div class="form-check">
<input type="checkbox" class="form-check-input" [(ngModel)]="item.checked" (ngModelChange)="onCheckedChange()" [disabled]="item.disabled" [indeterminate]="item.indeterminate" />
<label class="form-check-label" (click)="item.checked = !item.checked; onCheckedChange()"> {{item.title}} </label>
<label class="form-check-label">
<section *ngIf="item.children">
<img class="icon icon-w tree-view-all" src="assets/img/checked.svg" *ngIf="item.checked && item.internalChecked" (click)="selectChildren(item)" />
<img class="icon icon-w tree-view-all" src="assets/img/unchecked.svg" *ngIf="!item.checked || !item.internalChecked" (click)="selectChildren(item)" />
</section>
</label>
</div>
</div>
в компоненте используется рекурсивная функция
import { TreeviewComponent } from 'ngx-treeview';
...
@ViewChild(TreeviewComponent) treeviewComponent: TreeviewComponent;
...
selectChildren(i: TreeviewItem) {
i.collapsed = false;
if (i.children) {
this.selectInsideChildren(i);
i.checked = !i.checked;
}
this.treeviewComponent.raiseSelectedChange();
}
selectInsideChildren(item) {
item.children.forEach(i => {
i.checked = !i.checked;
if (i.children) {
this.selectInsideChildren(i);
}
});
}