Go ProSign in

This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Use the Angular CLI Environment to Define Constants

A default Angular application ships with two default environment files that can store constants that are different for each environment, one for development and the other for production.

We will define the apiUrl constant in both development and production environments.

The value for development is http://localhost:3000/api and the value for production is https://egghead-products-api.now.sh/api .

In angular.json we can find a configurations object where our production build is defined. We can see that in a production build, the environment.prod.ts will replace environment.ts.

You must be a Member to view code