CuppaLabs / cuppa-ng2-slidemenu

Angular 2 Slide Menu navigation componet for mobile and web
https://cuppalabs.github.io/cuppa-ng2-slidemenu/
17 stars 22 forks source link

side menu auto close #14

Open suriyaJaay opened 6 years ago

suriyaJaay commented 6 years ago

How to pls tell me how to auto close the side menu when clicking on particular menu.?

by doing this, how to load corresponding page while clicking menu routing.

pls share you ideas

rf2001dev commented 6 years ago

change app.component.ts

find:

private onItemSelect(item: any) { console.log(item); }

and just call onMenuClose()

so will be something like

private onItemSelect(item: any) { onMenuClose(); }

AndzejChwalko commented 6 years ago

You may use config attribute. In your html-template add:

<cuppa-slidemenu [menulist]="menuItems"
                 (onItemSelect)="onItemSelect($event)"
                 [config]="menuConfig">
  </cuppa-slidemenu>

In your component.ts add:

 private menuConfig: any = {
    animation: "collapse",
    offset: {  top: 55   },
    closeOnCLick: true
  };

Hope I helped you.

sbabu955 commented 5 years ago

menuclose is not happening even , if i use the above code.Menu items are showing