We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to use service in global interceptor.
My code look like this in Global-interceptor file:
import { VariablesService } from '../app/modules/variables/variables.service'; @Interceptor() export class globalInterceptor implements NestInterceptor { constructor(private service: VariablesService) { console.log('contructor running', service); //getting null here }
and on server.ts first i was initializing like this :
app.useGlobalInterceptors(new globalInterceptor())
but after the injection of service i have to do some modification because parameters are needed now in globalInterceptor()
const variableService = await app.get<VariablesService>(VariablesService); app.useGlobalInterceptors(new globalInterceptor(variableService));
Now what the problem is I am getting service is null . I am unable to create the object of the service
Stack-overflow : Link
The text was updated successfully, but these errors were encountered:
Hi @shaharyar123, I left an answer on the stackoverflow: https://stackoverflow.com/questions/50503996/how-to-use-service-in-global-interceptor-in-nest-js/50528691#50528691
Sorry, something went wrong.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
I want to use service in global interceptor.
My code look like this in Global-interceptor file:
and on server.ts first i was initializing like this :
app.useGlobalInterceptors(new globalInterceptor())
but after the injection of service i have to do some modification because parameters are needed now in globalInterceptor()
Now what the problem is I am getting service is null .
I am unable to create the object of the service
Stack-overflow : Link
The text was updated successfully, but these errors were encountered: