I want to define global constant variable for my API url, which I want to access at many places.
In what type of file it will defined, and how to access them.
I want to define global constant variable for my API url, which I want to access at many places.
In what type of file it will defined, and how to access them.
Use the files environment.ts
and environment.prod.ts
(for production) to define all your global const and call them like this :
environment.ts
export const environment = {
apiVersion: '1',
}
in other component or service
import { environment } from '../../environments/environment';
environment.apiVersion