I want to detect orientation change, to detect I am viewing my application in portrait mode or in landscape mode.So is there any event like orientation change which I can pass inside hostlistener in my component to detect orientation change?
P.S - Some guys are saying it duplicate question.I don't want plain java script way, I wanted the angular way to detect orientation change.
From MDN; you can use window:orientationchange
to detect when the orientation of the device has changed.
@HostListener('window:orientationchange', ['$event'])
onOrientationChange(event) {
console.log('orientationChanged');
}
Here is a short clip to see this in action in Chrome Dev Tools: https://streamable.com/o2ilm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With