Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

633
Views
Error angular: NG0200: Dependencia circular en DI detectada

Estoy trabajando en un proyecto angular donde tengo un servicio que obtiene los datos de una API.

El código de servicio:

 import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class CustomersService { constructor(public _HttpClient: HttpClient) { } getUsers(): Observable<any> { return this._HttpClient.get(`http://localhost:1234/labsystem/public/api/users`); } }

Y estoy inyectando el servicio en el componente que necesito para ver a los usuarios en él.

El código del componente:

 import { Component, OnInit } from '@angular/core'; import { CustomersService } from 'src/app/customers.service'; @Component({ selector: 'app-all', templateUrl: './all.component.html', styleUrls: ['./all.component.scss'] }) export class AllComponent implements OnInit { allUsers: any; constructor(public _CustomersService: CustomersService) { _CustomersService.getUsers().subscribe((data) => { this.allUsers = data; }, (error) => { console.log(error) }); } ngOnInit(): void { } }

El error en la consola del navegador:

ERROR Error: NG0200: Dependencia circular en DI detectada para CustomersService. Encuentre más en https://angular.io/errors/NG0200

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!