填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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.