I am new to the angular-cli and want to load url's for my api service calls by env. E.g.
local: http://127.0.0.1:5000
dev: http://123.123.123.123:80
prod: https://123.123.123.123:443
e.g. in environment.prod.ts
I assume this:
export const environment = {
production: true
"API_URL": "prod: https://123.123.123.123:443"
};
But from angular2, how do I call so I can get API_URL?
e.g.
this.http.post(API_URL + '/auth', body, { headers: contentHeaders })
.subscribe(
response => {
console.log(response.json().access_token);
localStorage.setItem('id_token', response.json().access_token);
this.router.navigate(['/dashboard']);
},
error => {
alert(error.text());
console.log(error.text());
}
);
}
Thanks