How to config different development environment in Angular 2 app

后端 未结 5 753
遇见更好的自我
遇见更好的自我 2020-12-08 04:37

I have a constant file

export class constants {
    public static get API_ENDPOINT(): string { return \'https://dvelopment-server/\'; }
}

5条回答
  •  猫巷女王i
    2020-12-08 05:00

    export class endPointconfig {
    
        public static getEnvironmentVariable() {
            let origin = location.origin;
            let path = location.href.split('/')[3];
            let value = origin +'/'+ path + '/api/';`enter code here`       
            return value;
        }
    }
    

提交回复
热议问题