Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-cli beta 14 - How to import Environment?

I just updated to the latest angular-cli (beta 14) which now uses webpack instead of systemjs.

I used to be able to import constants from the config/environment{prod|dev}.ts by simply importing it à la import { BASE_URL } from '../environment'. This doesn't work any more.
Environments are now defined in angular-cli.json and point to environments/environment{.prod}.ts but how do I access them in my components?

like image 757
TommyF Avatar asked Sep 19 '16 10:09

TommyF


1 Answers

Simply import in the environment.ts file and at build time the appropriate environments file will be supplied based upon the environment (dev/prod)

import { environment } from '../environments/environment';
like image 119
Brocco Avatar answered Oct 06 '22 20:10

Brocco