title: Using the enter key as tab using only angularjs and jqlite
body: <p>I have looked at multiple threads and tried a vast variety of solutions.
  Quite frankly I think I am losing my mind.</p>
  
  <p>I have an ng-repeat with inputs. All that needs to happen is that when the user presses enter, it should shift focus to the next input, basically simulating the tab key functionality.</p>
  
  <p>The code (incomplete):
  HTML:</p>
  
  <pre><code>&lt;body ng-app="ap" ng-controller="con"&gt; 
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Age&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr ng-repeat='person in persons'&gt;
          &lt;td&gt;
              &lt;input type='text'
                  name="personName"
                  ng-model="person.name" 
              /&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;input type='number'
                  name="personName"
                  ng-model="person.age" 
                  enter-as-tab
              /&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>JS:</p>
  
  <pre><code>    var app = angular.module("ap", []);
  
  app.controller("con", function ($scope) {
  
      $scope.persons = [
          { name: 'Susan', age: 1 }, 
          { name: 'Peter', age: 1 },
          { name: 'Jack', age: 2 }
      ];
  });
  
  app.directive('enterAsTab', function () {
      return function (scope, element, attrs) {
          element.bind("keydown keypress", function (event) {
              if(event.which === 13) {
                  event.preventDefault();
                  // Go to next age input                        
              }
          });
      };
  });
  </code></pre>
  
  <p>Here is a link to the fiddle: <a href="http://jsfiddle.net/staalburger/vpaqt29d/3/" rel="noreferrer">fiddle</a></p>