Skip to content
Guillaume Gendre edited this page Jun 7, 2019 · 5 revisions

This function is part of the navigate functions to switch between views in a Cobalt application.

Push

cobalt.navigate.push(options) create a new page and push it in front of the user. On Android, a new Activity is started. On iOS, the new view slides-in from the right of the screen.

options may contains the folowing :

  • page (required) is the html page you want to load from the root web folder. This parameter is required for the "push" and "modal" types.

  • controller is the name of the view you want to load. This view should be defined in the cobalt.json file. Default to a Cobalt controller.

  • data Optionnal data to send to the next page. The next page will receive this data in the cobalt:onPageShown message.

  • animated : Define if the page transition should be animated or not. Default to true.

Examples

//push next.html in a default controller
cobalt.navigate.push({ page : "next.html" });

//push next.html in MyCustomControllerName controller with no animation.
cobalt.navigate.push({ page : "next.html", controller:"myController", animated:false });

//push next.html and send it a data object
cobalt.navigate.push({ page : "next.html", data :{ hip : "hop" }})
Clone this wiki locally