ionic2:如何在app其他页面中更改单页面横向的方向?

时间:2017-05-10 06:33:30

标签: ionic2 orientation

在我的应用中,有一个页面需要在横向显示,其他页面以纵向显示,我使用ScreenOrientation插件

this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
当我在手机上运行并抛出一些异常时,

无效

"Error: Uncaught (in promise): NotSupportedError: screen.orientation.lock() is not available on this device.

我该怎么办?非常感谢你帮助我。

1 个答案:

答案 0 :(得分:2)

试试这个。
this.platform.ready().then(() => { this.screenOrientation.unlock(); this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE); });