In my library file product.data.ts, I have a collection of exported data that I need to update based on a value returned by a featureManagement service. Our team regularly uses this service and includes it in the constructor of any component using standard DI.
Is there a way to inject this service into the file without relying on a constructor or class?
const productUpdateLDFlag = () => {
// We cannot directly use the service here, but I am unsure how to inject it.
return this.featureManagement.getCurrentFlagValue(SwitchesProperty.productVersion);
};
rest of file
export const PRODUCTS_COMBINED: Array<Products> = [ProductA, ProductB, productUpdateLDFlag(), Product D]
What is the best way to utilize DI to bring in the featureManagement service and leverage it within the data.ts file?