Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Using Router to pass data between views

$
0
0

All,

 

I am using the router object and I am able to pass a simple id from one view to the next.

 

I have specified a route in my array of routes

var routes = [ { name: 'myroute', pattern: 'myroute', view: 'my.view' } ] ;

 

I navigate from one view to the next via the router.navTo('idOfView/:id:', { id: someId}, true); // this one works and shows up correctly in my url

 

 

when I try using router.navTo('idOfView', { obj:  someObject }, true); // I am not able to see the obj  in my object.

 

in my controller I have

 

var router = sap.ui.core.routing.Router.getRouter('myRouter');

router.attachedRoutePatternMatched(handlerFunction, this);

 

 

handlerFunction: function(){

  event.getParameter('arguments').id; // this oen works fine

   event.getParameter('arguments').obj;  // doesn't work. I cannot see the object.. it is an empty object.

}

 

 

how can I pass a JSON object between views?

 

thank you in advance


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>