官术网_书友最值得收藏!

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 as left or right, 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 the ionSideMenu directive.
主站蜘蛛池模板: 乐昌市| 南开区| 会宁县| 湖口县| 苏尼特左旗| 黑龙江省| 泰兴市| 潢川县| 罗平县| 天气| 武陟县| 壤塘县| 沧州市| 阳谷县| 上思县| 司法| 浦城县| 邵东县| 钟山县| 海丰县| 永兴县| 天全县| 彝良县| 思南县| 兴海县| 铜川市| 广河县| 白银市| 门头沟区| 资阳市| 焦作市| 石楼县| 堆龙德庆县| 册亨县| 白山市| 滦平县| 南漳县| 维西| 平塘县| 秦皇岛市| 雷州市|