Search code examples
onsen-ui

How to pass object from one Onsen UI page to another?


I have a js object loaded on one Onsen UI masterpage, when I called ons.navigator.pushPage('child_page.html') how can I get the js object on the child page?


Solution

  • See the documentation and guides.

    http://onsenui.io/guide/overview.html#PageNavigation

    You can get objects via the following methods:

    page1

    myNavigator.pushPage("page2.html", { param1: "value1", param2: "value2" });
    

    page2

    var page = myNavigator.getCurrentPage();
    console.log(page.options.param1); // Will return "value1"