typescript - Ionic running platform check not working as what API described -
i working ionic-angularjs 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
Post a Comment