【发布时间】:2021-02-03 01:30:28
【问题描述】:
我设置 strictTemplates:true 并在 HTML 模板中使用以下内容
<textarea matInput matAutosizeMaxRows="4" matTextareaAutosize="true"
我从编译器收到
error TS2322: Type 'string' is not assignable to type 'number'.
error TS2322: Type 'string' is not assignable to type 'boolean'.
但是如何在 HTML-Templates 中正确设置它(以避免错误)?
【问题讨论】:
-
您可以使用方括号属性绑定表示法 (
[attribute]="value")。 (有关更多信息,请参阅Angular docs on binding syntax)
标签: angular angular-ivy