How to save Angular global variable in may application

I am new at angular 2 + applications. I want to use some global objects in my angular 5 applciation. I have some angular components like this:

  • MapConponenet
  • LayersComponent
  • ZoomComponent

My MapConponenet will be created, when application start and it will create a global map object. And my other components will use that map object. LayerComponent and ZoomComponent needs map object and does not work without map object. So I could not decade where can I store this global map object using angular 2+ applications.

  • Should I use a global variable?
  • Should I create a service?
  • Should I use a browser localstorege?

Source: AngularJS