title: Angular textarea matInput: how can set max length/line + max number of lines
body: <p>The following html snippet of code:</p>
  
  <pre><code>&lt;mat-form-field class='textarea'&gt;
      &lt;textarea #txtarea matInput (change)='txtAreaChange()' [placeholder]="label" [(ngModel)]='text'&gt;&lt;/textarea&gt;
      &lt;mat-hint [class.red]="txtarea.value.split('\n').length &gt; textAreaLimit[1]" align="start"&gt; {{txtarea.value ? txtarea.value.split('\n').length : 0}}/{{textAreaLimit[1]}} lines&lt;/mat-hint&gt;
      &lt;mat-hint [class.red]="txtarea.value &amp;&amp; txtarea.value.split('\n').map( len).max() &gt; textAreaLimit[0]" align="end"&gt;Longest line: {{txtarea.value ? txtarea.value.split('\n').map( len).max() : 0}}/{{textAreaLimit[0]}}&lt;/mat-hint&gt;
  &lt;/mat-form-field&gt;
  </code></pre>
  
  <p>Defines a textarea input with two-way binding. It does check for size: total number of lines and max length of a line. If these are greater that some constraints given in <code>textAreaLimit</code> then the hints become red.</p>
  
  <p>I would like to change it so that the user cannot break this constraints, such as if the max number of line is 3 and there a 3 lines the user cannot add a new line. How can this be done without breaking the two-way binding?</p>