I want to add a character limit and I did this:

but it shows an error by "invalid" last line

<mat-form-field class="fbinput" appearance="outline" style="white-space: pre-wrap;" [formGroup]="myForm" > 
  <textarea
    [(ngModel)]="enteredContent"
    id="content"
    matInput rows="6"
    name="content"
    required
    [maxlength]="maxChars"
    formControlName="wordLimitation"
    placeholder="{{'Feedback.notizEingeben' | translate}}"
    #content
    ngModel="content"
    
    
      >
  </textarea>
  <mat-error *ngIf="content.invalid">{{'Warnung.feedbackEingeben' | translate}}</mat-error>

before the code was like this and had no errors

What can i do??

<mat-form-field class="fbinput" appearance="outline" style="white-space: pre-wrap;">
  <textarea
    [(ngModel)]="enteredContent"
    id="content"
    matInput rows="6"
    name="content"
    required
    placeholder="{{'Feedback.notizEingeben' | translate}}"
    #content="ngModel">
  </textarea>
  <mat-error *ngIf="content.invalid">{{'Warnung.feedbackEingeben' | translate}}</mat-error>
</mat-form-field>
  
</mat-form-field>

What can i do?? can someone help

0

There are 0 best solutions below