- Ionic:Hybrid Mobile App Development
- Rahat Khanna Sani Yusuf Hoc Phan
- 398字
- 2021-07-09 19:00:36
Ionic side menu
Ionic side menus also consist of multiple directives that help in achieving a layout with one or many side menus. It defines the layout of a section of your app. All the directives for this purpose are defined in this section.
The <ion-side-menus> directive
It is container for the ionSideMenu
directive and the main content. A left-side menu, right-side menu, or both can be added to the layout of your app. This directive/element must have at least two children, one should be an <ion-side-menu-content>
directive, which will load the views of the app, and one or more <ion-side-menu>
.
The different attributes available to be used with this directive are as follows:

The <ion-side-menu> directive
This directive is the place for side menu content. The side menu list view and other content can be included in this directive.
The following is the usage of this directive:
<ion-side-menu side="left" width="200" is-enabled="shouldLeftSideMenuBeEnabled()"> </ion-side-menu>
This directive has only three attributes: side
for defining the side it will slide from, width
to set the width of the side menu container, and is-enabled
to set an expression/function to evaluate whether the specific side menu should be enabled or not.
The <ion-side-menu-content> directive
This is the container for the main visible content. It can contain <ion-nav-view>
to show different views based on the state changes. It is always a sibling to the ionSideMenu
directive.
The following is the usage of this directive:
<ion-side-menu-content edge-drag-threshold="true" drag-content="true"> </ion-side-menu-content>
This directive has two attributes—edge-drag-threshold
, which defines whether content drag can be enabled or start below a threshold distance from the edge, and drag-content
, which enables whether content inside this directive can be dragged or not.
Other important directives
In order to work with side menus there are some more directives to be used:
menu-close
is an attribute directive that closes a currently opened side menu. This can be used on a link to navigate to a new view, which would close the side menu. It also resets the view's navigation history and removes the back button.menu-toggle
is an attribute that can be set on a button or icon used to toggle a side menu. The specific side menu such asleft
orright
, can be set to this attribute value.expose-aside-when
is an attribute that controls when the side menu should be kept open. In the case of large tablets, the side menu will always be opened. This directive should be given in theionSideMenu
directive.
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- Getting Started with React
- Android Jetpack開發:原理解析與應用實戰
- Instant Zepto.js
- Learn Swift by Building Applications
- Visual Basic程序設計實驗指導(第4版)
- 從0到1:Python數據分析
- Visual C#通用范例開發金典
- The DevOps 2.5 Toolkit
- C#實踐教程(第2版)
- OpenCV 3 Blueprints
- PHP與MySQL權威指南
- 邊玩邊學Scratch3.0少兒趣味編程
- INSTANT Apache ServiceMix How-to
- Elasticsearch Blueprints