[ionic] 存取 cordova 的 onready

Posted in :

這個 Platform 不需要去修改 /src/app/app.module.ts 檔,直接加到 constructor 裡就可以被使用。

URL:https://ionicframework.com/docs/api/platform/Platform/


Platform

Improve this doc

The Platform service can be used to get information about your current device. You can get all of the platforms associated with the device using the platformsmethod, including whether the app is being viewed from a tablet, if it’s on a mobile device or browser, and the exact platform (iOS, Android, etc). You can also get the orientation of the device, if it uses right-to-left language direction, and much much more. With this information you can completely customize your app to fit any device.

Usage

import { Platform } from 'ionic-angular';

@Component({...})
export MyPage {
  constructor(public plt: Platform) {

  }
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *