javascriptangularjsfirefoxdom-eventsorientation-changes

Firefox not support angular orientationchange event


I have a problem with orientationchange in FireFox... in Chrome I don't event have, the event is triggered but in FireFox it's not called. This is the code:

angular.element($window).on('orientationchange', function () { ... });

I have the same problem with:

angular.element($window).bind('orientationchange', function () { ... });

and native JavaScript code:

window.addEventListener('orientationchange', function () { ... });

I can't use jQuery... any solutions?


Solution

  • Finally I use this solution and it's well supported:

            $window.matchMedia("(orientation: portrait)").addListener(function(m) {
                // do something
            });