Ionic 2 - Landscape Orientation Enabled for iPad Only

I can set the orientation for portrait only in the config.xmlfollowing way:

<preference name="Orientation" value="portrait"/>

But how can I enable landscape orientation for the iPad, but still disconnecting the iPhone, as described above?

+4
source share
1 answer

According to Mike Harrison of Jonah, he says:

In addition to manually turning the device, in fact. It would be that you would write a plugin to change the main look of the application in Cordova

But there is a plugin from Ionic 1 , look at that. In the end, you can use it in Ionic 2.

With this plugin, you can do something like:

if(/(ipad)/i.test(navigator.userAgent)) {
  //THIS IS THE PLUGIN IONIC 1 CODE 
  $scope.changeOriantationPortrait = function() {
            screen.lockOrientation('portrait');
        }   
}
+3

Source: https://habr.com/ru/post/1673864/


All Articles