javascript - Ionic 2: best way to check if is running in browser environment -


i can't find out in docs best way know, in ionic 2 app, if it's runnning in browser (with ionic serve command) or in device/emulator.

actually i'm doing check if window object has 'plugins' attribute, don't know if there best way.

if(!window['plugins']) { //browser } 

oh, found in docs platform object, has methods. http://ionicframework.com/docs/v2/api/platform/platform/ 1 is(key), can match

import { platform } 'ionic-angular';  @component({...}) export mypage {   constructor(platform: platform) {     this.platform = platform;     ...     if(this.platform.is('core')) {      //it's in browser     }   } } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -