Search code examples
angularangular-servicesangular-components

Make Angular Service Available to All Components


I have a SpinnerService class that every single component in my Angular app uses. Is there a way to avoid explicitly injecting it in each component's constructor every time?


Solution

  • Sorry mate but that's the only way. Though if you have a hierarchal structure then you can just inject into your root component and send it as input parameter but that's also lead to creating an extra variable.