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

645
Views
Angular error: NG0200: Circular dependency in DI detected

I am working on angular project where I have a service that gets the data from an API.

The service code:

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`);
  }
}

And I am injecting the service in the component I need to view the users in it.

The component code:

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 {
  }

}

The error in the browser console:

ERROR Error: NG0200: Circular dependency in DI detected for CustomersService. Find more at 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!