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.

This component should only be used in Vanilla JS. Front-end frameworks normally provide a way to hide elements declaratively (ng-if, v-if, etc.).


名前 型 / デフォルト値 概要
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に記載をお願いいたします。