5 lines
2.5 KiB
JSON
5 lines
2.5 KiB
JSON
{
|
|
"id": "errors/NG2003",
|
|
"title": "NG2003: No suitable injection token for parameter",
|
|
"contents": "<h1 id=\"ng2003-no-suitable-injection-token-for-parameter\">NG2003: No suitable injection token for parameter<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"errors/NG2003#ng2003-no-suitable-injection-token-for-parameter\"><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/NG2003.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\n\n<div class=\"content\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"errors/NG2003#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>There is no injection token for a constructor parameter at compile time. <a href=\"api/core/InjectionToken\">InjectionTokens</a> are tokens that can be used in a Dependency Injection Provider.</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/NG2003#debugging-the-error\"><i class=\"material-icons\">link</i></a></h2>\n <p>Look at the parameter that throws the error and all uses of the class. This error is commonly thrown when a constructor defines parameters with primitive types like <code>string</code>, <code><a href=\"api/common/DecimalPipe\" class=\"code-anchor\">number</a></code>, <code>boolean</code>, and <code>Object</code>.</p>\n<p>Use the <a href=\"api/core/Injectable\">@Injectable</a> method or <a href=\"api/core/Inject\">@Inject</a> decorator from <code>@angular/core</code> to ensure that the type you are injecting is reified (has a runtime representation). Make sure to add a provider to this decorator so that you do not throw <a href=\"errors/NG0201\">NG0201: No Provider Found</a>.</p>\n\n</div>\n\n<!-- links to this doc:\n - errors\n-->\n<!-- links from this doc:\n - api/common/DecimalPipe\n - api/core/Inject\n - api/core/Injectable\n - api/core/InjectionToken\n - errors/NG0201\n - errors/NG2003#debugging-the-error\n - errors/NG2003#description\n - errors/NG2003#ng2003-no-suitable-injection-token-for-parameter\n - https://github.com/angular/angular/edit/master/aio/content/errors/NG2003.md?message=docs(...)%3A%20describe%20your%20change...\n-->"
|
|
} |