Today, i will show you how to create global variable in angular 8. we can define global variable in angular 8 application. i will give you simple example of global variables in angular 8.
We always need to declare global variable file for our angular 8 application because we can set some global variable there like site title, api url etc so you can easily access any where in our application easily.
So, in this example, we will create GlobalConstants file for adding global variables in our application. in that file i added two variables as apiURL and siteTitle. I will access those variable value in my AppComponent file. you can also access all the component as you want.
Now, bellow we will create GlobalConstants as like created bellow and We will use that variables as like used in AppComponent file.