Skip to content

Commit e3b3ca3

Browse files
committed
resolves #227: show child menu items whem items.length > 0
1 parent 2aa4683 commit e3b3ca3

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

angular/src/app/layout/sidebar-nav.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<span>{{menuItem.name}}</span>
1414
</a>
1515
<!-- Has child menu items (so, this is a parent menu) -->
16-
<a href="javascript:void(0);" class="menu-toggle" *ngIf="menuItem.items">
16+
<a href="javascript:void(0);" [ngClass]="{'menu-toggle': menuItem.items.length}">
1717
<i *ngIf="menuItem.icon" class="material-icons">{{menuItem.icon}}</i>
1818
<span>{{menuItem.name}}</span>
1919
</a>
@@ -31,7 +31,7 @@
3131
<span>{{subMenuItem.name}}</span>
3232
</a>
3333
<!-- Has child menu items (so, this is a parent menu) -->
34-
<a href="javascript:void(0);" class="menu-toggle" *ngIf="subMenuItem.items">
34+
<a href="javascript:void(0);" [ngClass]="{'menu-toggle': subMenuItem.items.length}">
3535
<i *ngIf="subMenuItem.icon" class="material-icons">{{subMenuItem.icon}}</i>
3636
<span>{{subMenuItem.name}}</span>
3737
</a>
@@ -57,4 +57,4 @@
5757
</li>
5858
</ng-template>
5959
</ul>
60-
</div>
60+
</div>

angular/src/shared/layout/menu-item.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class MenuItem {
1+
export class MenuItem {
22
name: string = '';
33
permissionName: string = '';
44
icon: string = '';
@@ -10,6 +10,11 @@
1010
this.permissionName = permissionName;
1111
this.icon = icon;
1212
this.route = route;
13-
this.items = childItems;
13+
14+
if (childItems) {
15+
this.items = childItems;
16+
} else {
17+
this.items = [];
18+
}
1419
}
15-
}
20+
}

0 commit comments

Comments
 (0)