I cant get this to work with the latest Ionic version.
I have created a new project with the latest ionic:
ionic start TestNgIf sidemenu --cordova --type=angular
Ionic Info Gives:
Ionic:
Ionic CLI : 5.2.7 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.8.1
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v12.9.1 (/usr/local/Cellar/node/12.9.1/bin/node)
npm : 6.10.3
OS : macOS Mojave
I have added platform to the homepage implementation and added the following html kode:
<ng-container
*ngIf="platform.isLandscape(); then showLandscape; else showPortrait">
</ng-container>
<ng-template #showLandscape>
<p>
showLandscape
</p>
</ng-template>
<ng-template #showPortrait>
<p>
showPortrait
</p>
</ng-template>
On the initial load the page works fine, but when i rotate the screen *ngIf does not recognize any changes.