-
Notifications
You must be signed in to change notification settings - Fork 14
Navigation_Replace
This function is part of the navigate functions to switch between views in a Cobalt application.
cobalt.navigate.replace(options) will replace the current page with the page you want without changing the app history.
The whole Activity or controller is replaced, it means the current page won't be in the navigation stack and you will not be able to pop to it.
You can use this for examples for a multiple steps form, an ad, or a side-menu implementation.
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.
-
clearHistory : use this boolean to clear the whole navigation hystory while replacing the current view. This sets the next page as the root page of your app. You may use this for a signIn or signOut experience. Default is false.
//replace the current page with next.html and a default controller
cobalt.navigate.replace({ page : "next.html" });
//replace the current page with next.html and a MyCustomControllerName controller with no animation.
cobalt.navigate.replace({ page : "next.html", controller:"myController", animated:false });
//load home.html and sets it as the new root page of your app
cobalt.navigate.replace({ page : "home.html", clearHistory : true });
Cobalt is an Open-Source Hybrid Mobile Framework. Read more about it on the home page or in the documentation
- Introduction to Cobalt navigation
- The cobalt.json file
- native navigation bars
- Handling the Android back button
- Introduction to Cobalt messages
- Publish/Subscribe on the Web side
- Publish/Subscribe on Android
- Publish/Subscribe on iOS
- Web Lifecycle messages
- Pull-To-Refresh and Infinite Scroll
- Custom alerts and Toasts
- LocalStorage
- OpenExternalUrl
- PlatformInfos
- Ajax
- Removing the top bar
- Adding Cobalt to an existing project
- Customizing your hybrid views
- Handle multiple Cobalt webviews on the same screen (TODO)