0

I am new in Angular 4 developement with typescript : I want to create a reusable static object in app.component.ts and get its value in all components How can I do this ?

Nawrez
  • 3,314
  • 8
  • 28
  • 42

1 Answers1

2

To share values or method between components, you need to create a service, for example, a user.service.ts that share the currently logged in user and spread his infos in the components where it is injected.

Here's the official documentation about angular services : https://angular.io/tutorial/toh-pt4

Boulboulouboule
  • 4,087
  • 1
  • 13
  • 29