Conditional element

<ons-if> will let you filter the content of your app depending on some variables:

  • platform attribute: allows or removes content depending on the running platform. Possible values are ios, android, windows and other. Normally you will include an android condition and a ios other condition.
  • orientation attribute: Possible values are landscape and portrait. Unlike the platform, this attribute is dynamic so it refreshes the view when changing the orientation.

In AngularJS this element can be substituted by the more powerful ng-if, ng-switch, ng-show or ng-hide directives. Use ons.platform and ons.orientation methods to achieve a similar result.


名前 型 / デフォルト値 概要
platform string Space-separated platform names. Possible values are "ios", "android", "windows" and "other". (翻訳中) Optional. 初期化時のみ有効
orientation string portraitもしくはlandscapeを指定します Optional.


Onsen UIに関する質問は、Stack Overflowにてonsen-uiタグを付与してください。Onsen UIチームはあなたの問題解決をお手伝いします。

バグ報告や機能要望については、GitHub Issuesに記載をお願いいたします。