Add your variable and make sure that you configure each environment.
// ./public_html/src/environments/environment.ts or environment.prod.ts
export const environment = {
production: false,
apiUrl: 'https://example.apiurl.dev'
};
Then import the environment variables and use where necessary.
// ./public_html/src/app/example.ts
import {environment} from '../environments/environment';
export class Example {
public envOptions = {
apiUrl : environment.apiUrl
// ...
}
// ...
}