Angular: strictTemplates - How to set boolean and numbers in Templates properly?
问题 I set strictTemplates:true and use in a HTML template the following <textarea matInput matAutosizeMaxRows="4" matTextareaAutosize="true" I receive from the compiler error TS2322: Type 'string' is not assignable to type 'number'. error TS2322: Type 'string' is not assignable to type 'boolean'. But how to set it properly in the HTML-Templates (to avoid the error)? 回答1: Wrap the property name in brackets. If you leave the brackets, the values will be interpreted as strings. With brackets, the