It is important for your user interface to adapt to which platform it’s currently serving. Ionic already do this for you but until for some extent. For example, if you want the floating action button to only appear on Android devices, you need to do it by yourself.
First, import Platform from the ionic/angular library.
Then, inject it into the constructor.
Detect Screen’s Orientation
To detect screen’s orientation, inside your html file, use *ngIf to make the html tag to hide/appear depending on the screen’s orientation. The example below make the update the ion-label based on the screen’s orientation.
Detect Platform’s OS
To detect the platform Ionic currently serving, inside your html file, use *ngIf to make the html tag to hide/appear depending on the OS whether it is Android or iOS. The example below make the update the ion-label based on the device’s OS.
That’s it for this tutorial, see you guys next time.
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.