You can create this component for global variables: - "app.global.ts"
import { Injectable } from '@angular/core';
@Injectable()
export class AppGlobals {
readonly baseAppUrl: string = 'http://localhost:57431/';
readonly baseAPIUrl: string = 'https://api.github.com/';
}
then you use it in your project calling it like this:
import { AppGlobals } from '../shared/app.globals';
lo llamas en el constructor:
constructor(private userService: UserService, private _global: AppGlobals) { }
//GET USERS SERVICE ON PAGE LOAD.
this.userService.getAPIUsers(this._global.baseAPIUrl + users/hadley/orgs').subscribe(data => this.users = data);
================================================================================================= ====
for global variables.