title: Set html5 input maxlength attribute with AngularJS
body: <p>I want to set the maxlength of an input via AngularJS and when the user have reached the maximum characters then no new characters should be added to the input.</p>
  
  <p>I have an input which ng-model is <code>selecteddata.Type.Value</code></p>
  
  <p>The max character value is stored in <code>selecteddata.Type.MaxLength</code> </p>
  
  <p>I've added the html5 maxlength attribute as below:</p>
  
  <pre><code>&lt;input type="text" ng-model="selecteddata.Type.Value" maxlength="{{selecteddata.Type.MaxLength}}" /&gt;
  </code></pre>
  
  <p>This works as I want to, when the user reach the maximum characters it's not possible to add new but it doesn't set the selecteddata.Type.Value..</p>
  
  <p>Why doesn't this work? Is there a AngularJS way of doing this? I've read about ngMaxlength but it doesn't behave as I want. Do I need to write a custom directive to make this work?
  Any suggestions? </p>