I'm working on an angular-app and am trying to implement orientation change with matchmedia. When I first load my page I run a line of code in my controller to check wheter if i'm in landscape or not:
$scope.landscape = matchmedia.isLandscape();
This works fine. But then when I want to detect a change of orientation I use this code:
angular.element($window).bind('orientationchange', function () {
$route.reload();
});
So when the orientation changes the page gets reloaded and it will again detect the orientation. But now it gives back the opposite. So it says landscape == false when it should be true. Does anybody know why this is? Or am I using a wrong technique to deal with the orientation change? Thanks in advance!