G
G
Ghoulll2020-02-21 10:41:37
Angular
Ghoulll, 2020-02-21 10:41:37

Angular variable change for production?

How to change some variables for production? There are addresses to which I send requests, for local development, but for production it is necessary to send requests to other addresses, how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Khegay, 2020-02-21
@Ghoulll

To help you src\environments
There is environment.ts - it is used by default
When building the project:
ng build --prod
the --prod flag is substituted into the mask *.environment.ts
It is simply imported into the component:

import { environment } from 'src/environments/environment';

export class AppComponent implements OnInit {
     url = environment.apiUrl;
}

You can read in more detail here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question