How do I pass an object from one Onsen UI page to another?
I have a js object loaded in one main Onsen UI page when I called ons.navigator.pushPage ('child_page.html') how can I get the js object in the child page?
+3
Eli
source
to share
2 answers
See documentation and manuals.
http://onsenui.io/guide/overview.html#PageNavigation
You can get objects using the following methods:
p. 1
myNavigator.pushPage("page2.html", { param1: "value1", param2: "value2" });
page2
var page = myNavigator.getCurrentPage();
console.log(page.options.param1); // Will return "value1"
+8
Ataru
source
to share
In OnsenUI 2, you can access this:
var options = myNavigator.topPage.pushedOptions;
I tried ataru's answer but didn't work for me, I guess it's because of RC Version
hope they fix it, or at least change their documentation about it.
+4
Morteza tourani
source
to share