-
Notifications
You must be signed in to change notification settings - Fork 15
Navigation_Modals
This function is part of the navigate functions to switch between views in a Cobalt application.
With cobalt.navigate.modal(options) a new navigation is started from this point. You can choose a page and a controller, and push some other pages in it.
The new page appears from the bottom of the app to the top.
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 (optionnal) 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.
When cobalt.navigate.dismiss() is called in a page that has been opened with a cobalt.navigate.modal(options), the user will be driven back to the page that opened the modal at first time.
dismiss takes an optionnal parameter :
- data (optionnal) data to send back to the previous page. The previous page will receive this data in the cobalt:onPageShown message.
//open next.html in MyCustomControllerName controller.
cobalt.navigate.modal({ page : "next.html", controller:"myController" });
//dismiss the current modal and navigation stack.
cobalt.navigate.dismiss();
This uses the real "modal" component on iOS but fakes it on Android.
We will rework the feature as soon we will be able to custom animations on push transistion and we will use the popTo command under the hood.
We believe we will keep those modal and dismiss commands at least as a shortcut.
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)