error TS2322: Type 'string' is not assignable to type 'number' for rows in textArea

1 Answer 14813 Views
TextArea
vamaw
Top achievements
Rank 1
Iron
Iron
vamaw asked on 17 Jun 2021, 10:03 AM

Hi,

 

Where is my mistake ?

Regards

  <kendo-textarea
#modifyContactNoteInput
formControlName="modifyContactNoteInput"
rows="10"
placeholder="Leave a comment"
id="modifyContactNoteInput"
class="NoteDossier"
></kendo-textarea>
</div>

1 Answer, 1 is accepted

Sort by
0
Yanmario
Telerik team
answered on 18 Jun 2021, 02:05 PM

Hi Vamaw,

Thank you for providing a code snippet.

The TypeScript error is caused by the rows input property being assigned to a string type, and it needs to be of type number. To solve this issue, the correct type needs to be assigned to the rows field as follows:

    <kendo-textarea
    #modifyContactNoteInput
    formControlName="modifyContactNoteInput"
    [rows]="rows"
    placeholder="Leave a comment"
    id="modifyContactNoteInput"
    class="NoteDossier"
  ></kendo-textarea>

component ts file:

public rows : number = 10;

Shorter solution:

<kendo-textarea
    #modifyContactNoteInput
    formControlName="modifyContactNoteInput"
    [rows]="5"
    placeholder="Leave a comment"
    id="modifyContactNoteInput"
    class="NoteDossier"
  ></kendo-textarea>

I hope this helps.

Regards,
Yanmario Menev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TextArea
Asked by
vamaw
Top achievements
Rank 1
Iron
Iron
Answers by
Yanmario
Telerik team
Share this question
or