How to restrict app rotation?

I just wanna restrict my app to work in Portrait mode. How to disable app rotation? @leob Hope you have knowledge on this…

Hi, I think this question has been discussed and answered before on the Ionic forum, the simplest way seems to be this:

Freezing portrait mode

So, quoting the answer:

In config.xml include following:

<preference name="SplashScreen" value="screen" />
<preference name="orientation" value="portrait" />
<preference name="SplashScreenDelay" value="5000" />

and inside $ionicPlatform.ready(function() {}) include following:

if(window.navigator && window.navigator.splashscreen) {
window.plugins.orientationLock.unlock();
} 

I saw more discussions and solutions but this seems to be the easiest one.

config.xml

This is not working @leob… Should I install any plugin?

Yeah I’ve also seen people talk about a plugin:

Freezing portrait mode
Ionic View iOS App: Screen Orientation Locked?
http://www.gajotres.net/changing-locking-screen-orientation-in-ionic-application/

So then you can try that (I don’t have experience with any of this since I don’t have this requirement).