cuppa-ng2-slidemenu
cuppa-ng2-slidemenu copied to clipboard
The menu items do not link to pages. The demo just writes to the console. Would you provide an example of linking to a page in the app.
Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass
-
I'm submitting a ... [ ] bug report [ ] feature request [ ] question about the decisions made in the repository
-
Do you want to request a feature or report a bug?
-
What is the current behavior?
-
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).
-
What is the expected behavior?
-
What is the motivation / use case for changing the behavior?
-
Please tell us about your environment:
- Angular version: 2.0.0-beta.X
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
Hi, once you get the clicked item object in the callback method, you can use router.navigate('your_router_url') to navigate to the respective url. This feature facilitates the menu to be used both for url navigation as well as simple item select and perform actions. Hope this helps !! if so, close the issue.
only use the function that show the article. this functions onItemSelect should be contain the function navigate or navigateByUrl using item.link private onItemSelect(item:any){ console.log(JSON.parse(JSON.stringify(item.link))); this.router.navigateByUrl(JSON.parse(JSON.stringify(item.link))); } now I just need to know how to hide the slide again, because it is showing later that used the link
HTML
{'title': 'Timetable', 'link': 'client/timetable'},
TS
Import the router
import {Router} from '@angular/router';
Inject it to your typescript component
constructor(private router: Router) { }
Make your onItemSelect method to get the object passed as a parameter and navigate to it using router
private onItemSelect(item: any) { console.log(item); this.router.navigateByUrl(item.link); }
HTML {'title': 'Timetable', 'link': 'client/timetable'},
can you please let me know above link is root path folder ? example : projectname/src/app/client/timetable ?