5 lines
2.9 KiB
JSON
5 lines
2.9 KiB
JSON
|
{
|
|||
|
"id": "errors/NG0200",
|
|||
|
"title": "NG0200: Circular dependency in DI detected while instantiating a provider",
|
|||
|
"contents": "<h1 id=\"ng0200-circular-dependency-in-di-detected-while-instantiating-a-provider\">NG0200: Circular dependency in DI detected while instantiating a provider<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"errors/NG0200#ng0200-circular-dependency-in-di-detected-while-instantiating-a-provider\"><i class=\"material-icons\">link</i></a></h1>\n<div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/aio/content/errors/NG0200.md?message=docs(...)%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n</div>\n\n\n<div class=\"error-video-container\">\n <iframe src=\"https://www.youtube.com/embed/CpLOm4o_FzM\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n</div>\n\n\n\n<div class=\"content\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"errors/NG0200#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>A cyclic dependency exists when a <a href=\"guide/hierarchical-dependency-injection\">dependency of a service</a> directly or indirectly depends on the service itself. For example, if <code>UserService</code> depends on <code>EmployeeService</code>, which also depends on <code>UserService</code>. Angular will have to instantiate <code>EmployeeService</code> to create <code>UserService</code>, which depends on <code>UserService</code>, itself.</p>\n\n</div>\n<br>\n<div class=\"debugging\">\n <h2 id=\"debugging-the-error\">Debugging the error<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"errors/NG0200#debugging-the-error\"><i class=\"material-icons\">link</i></a></h2>\n <p>Use the call stack to determine where the cyclical dependency exists. You will be able to see if any child dependencies rely on the original file by <a href=\"guide/dependency-injection-in-action\">mapping out</a> the component, module, or service’s dependencies and identify the loop causing the problem.</p>\n<p>Break this loop (or circle) of dependency to resolve this error. This most commonly means removing or refactoring the dependencies to not be reliant on one another.</p>\n\n</div>\n\n<!-- links to this doc:\n - errors\n-->\n<!-- links from this doc:\n - errors/NG0200#debugging-the-error\n - errors/NG0200#description\n - errors/NG0200#ng0200-circular-dependency-in-di-detected-while-instantiating-a-provider\n - guide/dependency-injection-in-action\n - guide/hierarchical-dependency-injection\n - https://github.com/angular/angular/edit/master/aio/content/errors/NG0200.md?message=docs(...)%3A%20describe%20your%20change...\n-->"
|
|||
|
}
|