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

NG8002: Unknown attribute or input
未知的 HTML 属性或输入属性

说明

Description

在编译过程中无法解析的 Attribute 或 Property。

An attribute or property cannot be resolved during compilation.

尝试绑定到不存在的属性时会出现此错误。任何属性绑定都必须符合以下任一条件:

This error arises when attempting to bind to a property that does not exist. Any property binding must correspond to either:

  • HTML 元素上的原生属性,或者

    A native property on the HTML element, or

  • 应用于元素的组件或指令的 @Input() 输入属性。

    An @Input() property of a component or directive applied to the element.

其运行时错误为 NG0304: '${tagName}' is not a known element: …'

The runtime error for this is NG0304: '${tagName}' is not a known element: …’.


如何排除本错误

Debugging the error

请参阅文档以了解所使用的特定绑定语法。这通常是因为拼写错误或不正确的导入。还有一种可能是属性选择器缺少方向,或缺少输入属性。

Look at documentation for the specific binding syntax used. This is usually a typo or incorrect import. There may also be a missing direction with property selector ‘name’ or missing input.