mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-24 02:06:11 +01:00
maps components structure created
This commit is contained in:
parent
bff8af282e
commit
57b694c81b
9 changed files with 78 additions and 15 deletions
|
|
@ -102,22 +102,23 @@ export class Sidebar {
|
|||
private selectMenuItem() {
|
||||
let currentMenu;
|
||||
|
||||
let isCurrent = (instruction) => (instruction ? this._router.isRouteActive(this._router.generate([instruction])) : false);
|
||||
let isCurrent = (instructions) => (instructions.filter(i => typeof i !== 'undefined').length > 0 ? this._router.isRouteActive(this._router.generate(instructions)) : false);
|
||||
let assignCurrent = (menu) => (menu.selected ? currentMenu = menu : null);
|
||||
|
||||
this.menuItems.forEach(function (menu: any) {
|
||||
|
||||
menu.selected = isCurrent(menu.name);
|
||||
menu.selected = isCurrent([menu.name]);
|
||||
menu.expanded = menu.expanded || menu.selected;
|
||||
assignCurrent(menu);
|
||||
|
||||
if (menu.subMenu) {
|
||||
menu.subMenu.forEach(function (subMenu) {
|
||||
subMenu.selected = isCurrent(subMenu.name) && !subMenu.disabled;
|
||||
subMenu.selected = isCurrent([menu.name, subMenu.name]) && !subMenu.disabled;
|
||||
assignCurrent(menu);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// notifies all subscribers
|
||||
this._themeGlobal.setData('menu.activeLink', currentMenu);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue