on 06-03-2014 12:58 PM
I have a question about Routing. I have an example where I am using eventbus which yes I takes me to my next view depending if I am navigation to or back, etc.
is there a way for me to use event bus and also be able to go directly to a page in my app, such as using: urlToApp/#viewName or something similar? any help would be appreciated?
I believe the alternative would be something using routing, but I haven't found a good example for it.
thank you in advance,
Sergio
Hi Sergio,
Yes, routing is the way out. Refer this documentation for help.
Thanks and best regards,
Shilpa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First of all you have to load your views:
sap.ui.localResources('folderWithViews');
then follow this example:
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.core.routing.Router
your code will end up with something like this:
//Somewhere at the start of your application
var aRoutes = [ { pattern : "product/{id}", // will be the url and from has to be provided in the data name : "specificProduct" // name used for listening or navigating to this route } ];
var oRouter = new sap.ui.core.routing.Router(aRoutes); //this is used to retrieve the instance again
oRouter.register("appRouter"); //starts reacting on the hashchange + parses the current hash and notifies callbacks
oRouter.initialize();
also, look at section 8.10 in the SAPUI5 Developer Guide for SAP HANA Document Version 1.0 2014-05-28
User | Count |
---|---|
83 | |
9 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.