typescript - Ionic running platform check not working as what API described -


i working framework gives me following definitions platform:

  • android - on device running android.
  • cordova - on device running cordova.
  • core - on desktop device.
  • ios - on device running ios.
  • ipad - on ipad device.
  • iphone - on iphone device.
  • mobile - on mobile device.
  • mobileweb - in browser on mobile device.
  • phablet - on phablet device.
  • tablet - on tablet device.
  • windows - on device running windows.

i have code written in typescript, if condition not work when application run on mobile browsers. expect receive mobileweb doesn't seem working.

import { platform } 'ionic-angular';  @component({...}) export mypage {   constructor(public platform: platform) {      if (this.platform.is('core') || this.platform.is('mobileweb')) {         // login page      }     else{         // home page     }   } } 

however doesn't seem work. suggestion on how can fix problem.

you need make sure platform ready before executing code.

this.platform.ready().then(() => {    // condition here  }) 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -