LeO*_*LeO 7 angular angular-ivy
我strictTemplates:true
在 HTML 模板中设置并使用了以下内容
<textarea matInput matAutosizeMaxRows="4" matTextareaAutosize="true"
Run Code Online (Sandbox Code Playgroud)
我从编译器收到
error TS2322: Type 'string' is not assignable to type 'number'.
error TS2322: Type 'string' is not assignable to type 'boolean'.
Run Code Online (Sandbox Code Playgroud)
但是如何在 HTML 模板中正确设置它(以避免错误)?
JSO*_*ulo 11
将属性名称括在方括号中。如果您保留方括号,则这些值将被解释为字符串。使用方括号,这些值被解释为 TypeScript,因此可以正确键入。
<textarea matInput [matAutosizeMaxRows]="4" [matTextareaAutosize]="true"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2126 次 |
最近记录: |