diff --git a/src/app/menu-test/menu-test.component.ts b/src/app/menu-test/menu-test.component.ts index 41fba7ece9..49a5cccd09 100644 --- a/src/app/menu-test/menu-test.component.ts +++ b/src/app/menu-test/menu-test.component.ts @@ -88,9 +88,9 @@ export class NbMenuItem4Component { } - + - + diff --git a/src/framework/theme/components/menu/menu.service.ts b/src/framework/theme/components/menu/menu.service.ts index edf4804cbb..606b75be79 100644 --- a/src/framework/theme/components/menu/menu.service.ts +++ b/src/framework/theme/components/menu/menu.service.ts @@ -215,8 +215,14 @@ export class NbMenuInternalService { }); } + private isParent(parent, child) { + return child.parent + ? child.parent === parent || this.isParent(parent, child.parent) + : false; + } + private collapseItem(item: NbMenuItem, tag: string, except?: NbMenuItem) { - if (except && item === except) { + if (except && (item === except || this.isParent(item, except))) { return; }