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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -