TommyF
TommyF

Reputation: 7150

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?

Upvotes: 10

Views: 6150

Answers (1)

Brocco
Brocco

Reputation: 64883

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';

Upvotes: 24

Related Questions