填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

NG8001: Unknown HTML element or component
未知的 HTML 元素或组件

说明

Description

在编译期间无法解析一个或多个元素,因为该元素不是由 HTML 规范定义的,或者该元素选择器不包含任何组件或指令。

One or more elements cannot be resolved during compilation because the element is not defined by the HTML spec, or there is no component or directive with such element selector.

这是常见运行时错误 NG0304: '${tagName}' is not a known element: … 的等价物。

This is the compiler equivalent of a common runtime error NG0304: '${tagName}' is not a known element: ….


如何排除本错误

Debugging the error

在错误中根据元素名称来查找正在使用该元素的文件。

Use the element name in the error to find the file(s) where the element is being used.

检查名称和选择器是否正确。如果该组件来自其他模块或导入,请检查该组件是否已从其原始模块中导出并导入到了正确的 *.modules.ts 文件中,并已在导入列表中声明过。

Check that the name and selector are correct. If the component is from a different module or import, check that the component is exported from its origin module and imported into the correct *.modules.ts file, and declared in the imports list.

使用自定义元素或 Web 组件时,请确保将 CUSTOM_ELEMENTS_SCHEMA添加到 AppModule 中。

When using custom elements or web components, ensure that you add CUSTOM_ELEMENTS_SCHEMAto the app module.

如果还不能解决此错误,请检查导入的库,以检查对正在使用的导出和属性的任何最新更改,然后重新启动服务器。

If this does not resolve the error, check the imported libraries for any recent changes to the exports and properties you are using, and restart your server.