我在Web Service-WCF中有一个类别树,按所有级别排序。 每个类别都有三个组成部分:
我希望这棵树也以打字稿出现在Angular 6一侧。
这是component.htm
文件:
<div class="categories">
<div *ngFor="let category of categories">
<h6>{{category.Name}}-<label > წიგნების რაოდენობა {{category.BookCount}}</label> </h6>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let subCategory of list">
<div>{{subCategory.Name}}- <label > წიგნების რაოდენობა {{subCategory.ChildBookCount}}</label></div>
<ul *ngIf="subCategory.ChildCategory?.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: subCategory.ChildCategory }"></ng-container>
</ul>
</li>
</ng-template>
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: category.ChildCategory }"></ng-container>
</ul>
</div>
</div>