I would like to pass values taken from the related environment file (env.json) in the app.module but these values are not available at the moment of the initialization of the GtmModule (are available several ms after initialization).
I would like to ask which approach should be used to achieve values. I tried @Inject and custom Factory but without luck.
GtmModule.forRoot({
debug:environment.gaAnalyticsDebug,
disabled:environment.gaAnalyticsDisabled, // GETTING UNDEFINED HERE
gtmId: 'XXXX',
readExtIdCookie: false,
}),
Create separate environment files :
environment.staging.ts :
In your angular.json file :
In your app.module.ts :