1
Ich verwende plain JS, um die Bildschirmausrichtung des Geräts zu erkennen, aber ich habe keine Ahnung, wie Elemente abhängig von der Ausrichtung angezeigt oder ausgeblendet werden. Grundsätzlich ist das gleiche wie bei Ionic V2: HideWhenWie können Elemente abhängig von der Bildschirmausrichtung im ionischen Rahmen angezeigt/ausgeblendet werden?
angular.module('starter', [
'ionic',
'ngCordova',
....
])
.run(function($ionicPlatform, $rootScope, $state) {
$ionicPlatform.ready(function() {
...
window.addEventListener('orientationchange', function() {
switch(window.orientation) {
case -90: case 90:
// landscape
// how to get this into the controllers scope?
break;
default:
// portrait
// how to get this into the controllers scope?
break;
}
});
});
});
einen Auszug aus der Vorlage Das ist
<img class="cover" ng-src="http://i.imgur.com/vkW3Lhe.jpg" ng-show="orientation.landscape">
<img class="cover" ng-src="http://i.imgur.com/vkW3Lhe.jpg" ng-show="orientation.portrait">
Dies ist eine nicht getestete schnell Antwort und sollte mit '$ window' et. refaktoriert werden. al. – malix