angularng-zorro-antd

How to close the Ng-Zorro menu after user click on menu-item or outside the menu?


How to close the Ng-Zorro menu after user click on menu-item or outside the menu?

https://ng.ant.design/components/menu/en#components-menu-demo-horizontal


Solution

  • This property nzInlineCollapsed is responsible for displaying and hiding menu, so if you bind menu click event with this nzInlineCollapsed it will then it will hide if the property with which it is binded is false. Here isCollapsed is binded with nzInlineCollapsed so it on button click isCollapsed is turned false then your menu will hide.

    <ul nz-menu nzMode="inline" [nzInlineCollapsed]="isCollapsed">