Currently, I am using plugins and libraries in my Angular app by directly referencing their functions/methods without considering dependency injection. This approach is common in most apps, but I want to optimize the use of these resources.
One such library I rely on is "MomentJS" for date formatting and validation across various components like controllers, services, and filters. Typically, I create a service in AngularJS that references the library's function and inject it into controllers successfully.
However, the challenge arises when I need to utilize this library in different types of components beyond just controllers. How can I implement dependency injection in filters, services, and other components? Is it feasible and advantageous?
I would appreciate any guidance on this matter. Thanks in advance :)