0

Is it possible to add global lifecycle hooks for every component instead of doing it one by one ? Example: I want on each component initialization to be called a function.

Denko Mancheski
  • 2,709
  • 2
  • 18
  • 26

1 Answers1

0

I believe that's not officially possible.

I haven't seen an example like this in the Angular 2 docs. The component lifecycle events are implemented per instance.

PS: If you find a hackish way to do it, I wouldn't recommend you to do so. I bet there's a better alternative to handle your use-case :)

Kaloyan Kosev
  • 12,483
  • 8
  • 59
  • 90