Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 要识别的环境变量是否部署在移动应用程序或Web应用程序上?_Node.js_Angularjs_Ionic Framework_Ionic5 - Fatal编程技术网

Node.js 要识别的环境变量是否部署在移动应用程序或Web应用程序上?

Node.js 要识别的环境变量是否部署在移动应用程序或Web应用程序上?,node.js,angularjs,ionic-framework,ionic5,Node.js,Angularjs,Ionic Framework,Ionic5,嗨,我使用离子5与角。我有一个移动应用程序,我目前正在开发一个Web应用程序,它使用与移动应用程序相同的代码库 我正在寻找一种方法来配置一些环境变量,以识别应用程序是部署在移动应用程序还是Web应用程序上。谢谢:) import {Platform } from '@ionic/angular'; @Component({ templateUrl: 'app.html' }) export class MyApp { rootPage = HomePage; construc

嗨,我使用离子5与角。我有一个移动应用程序,我目前正在开发一个Web应用程序,它使用与移动应用程序相同的代码库

我正在寻找一种方法来配置一些环境变量,以识别应用程序是部署在移动应用程序还是Web应用程序上。谢谢:)

import {Platform } from '@ionic/angular';

@Component({
templateUrl: 'app.html'
})
export class MyApp {
    rootPage = HomePage;

    constructor(platform: Platform) {
        platform.ready().then(() => {

            if (this.platform.is('android')) {
                console.log("running on Android device!");
            }
            if (this.platform.is('ios')) {
                console.log("running on iOS device!");
            }
            if (this.platform.is('mobileweb')) {
                console.log("running in a browser on mobile!");
            }

        });
    }
}