Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

789
Vistas
NG0200: Circular dependency in DI detected for ApplicationRef

I got the following error while refactoring the app:

main.ts:21 Error: NG0200: Circular dependency in DI detected for ApplicationRef. Find more at https://angular.io/errors/NG0200
    at throwCyclicDependencyError (core.js:216)
    at R3Injector.hydrate (core.js:11433)
    at R3Injector.get (core.js:11256)
    at injectInjectorOnly (core.js:4751)
    at Module.ɵɵinject (core.js:4755)
    at Object.Config_Factory [as factory] (config.ts:7)
    at R3Injector.hydrate (core.js:11437)
    at R3Injector.get (core.js:11256)
    at injectInjectorOnly (core.js:4751)
    at Module.ɵɵinject (core.js:4755)

But I haven't found any circular dependencies. What else can be the cause?

8 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It was caused by injecting a custom service into ErrorHandler:

@Injectable()
export class GlobalErrorHandler extends ErrorHandler {
  /*constructor(protected readonly customService: CustomService) {
    super();
  }*/
}

Seems like only Angular's services (like HttpClient) can be injected there.

8 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos