I do not think that you can control the proxy function through environment files. An alternative would be to define your api domains in your environment files
export const environment = {
production: false,
api: 'http://localhost:3000'
};
export const environment = {
production: true,
api: 'http://api.exampledomain.com'
}
then in the ts source files pull the domain from the environment file
import { Injectable } from '@angular/core';
import { environment } from '../../../environment.ts';
import { Http } from '@angular/http';
@Injectable()
export class SomeService {
constructor(private http: Http);
getData(){
return this.http.get(environment.api + '/rest-of-api');
}
}
now when you run build or maintenance commands, they will use the api path defined in the environment file
source
share