title: Input box issue with max-length and match
body: <p>I am using max length to limit my input to 6 numbers. The issue is it stops after 6. I think the issue is with the regex match I am using to separate the input and the max length.</p>
  
  <pre><code>&lt;input type="text" ng-keyup="addHyphen($event)" id="sortcode" name="sortcode" maxlength="6" ng-model="data.branchTransitNumber" required numbers-only/&gt;
  </code></pre>
  
  <p><strong>Script:</strong></p>
  
  <pre><code> $scope.addHyphen = function() {
           // $scope.dashed= angular.element($event.target.value);
           var ele = document.getElementById('sortcode');
           ele = ele.value.split('-').join('');
           $scope.data.branchTransitNumber = ele.match(/.{1,2}/g).join('-');
  
        };
  </code></pre>
  
  <p><strong>Expected in input: 11-11-11</strong></p>
  
  <p><strong>Currently: 11-11-1</strong></p>
  
  <p>I am also not receving any console errors also.I think the regex wants to put - after two numbers and max length won't allow additional input. </p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>After removing the max-length its is working. But how to make it work along with max-length</p>