title: How to set max character length in angular mat text area?
body: <p>How can we check the total characters while user is typing in angular text area?</p>
  <p>While user input his data the text area will check the total character input and will show error if morethan 1000 characters and show now allow user to add more characters if exceeds.</p>
  <p>#code</p>
  <pre><code>&lt;mat-form-field appearance=&quot;outline&quot; class=&quot;pr-4&quot; fxFlex hintLabel=&quot;Max 1000 characters&quot;&gt;
                    &lt;mat-label&gt;Reason&lt;/mat-label&gt;
                    &lt;textarea (keypress)=&quot;textAreaKeyPress($event)&quot;
                      formControlName=&quot;text&quot;
                      [maxLength]=&quot;150&quot; 
                      matInput
                      required
                      cdkTextareaAutosize
                      cdkAutosizeMinRows=&quot;3&quot;
                      cdkAutosizeMaxRows=&quot;5&quot;
                    &gt;&lt;/textarea&gt;
                &lt;mat-error *ngIf=&quot;&quot;&gt;Max 1000 characters&lt;/mat-error&gt;
  </code></pre>