Good morning,
I understand that most people use Services in Angular as singletons to share the same instance of the service with other modules.
However, I have a specific need where I want each module that uses the service to create a new instance.
Let me explain further: I have a service called report-params-store-service that is designed to store data params for reports. I would like to inject this service into different types of reports such as INSS Reports, IRRF Reports, FGTS Reports, but I want each report to have its own isolated instance of the service without sharing data among them.
I want to avoid duplicating code by creating a separate instance of the report-params-store-service for each type of report.
Is this possible? And if so, how can I achieve it?
I tried putting the services in the providers section of each module, but it still behaves as a singleton service, sharing data across different modules.