Html 将tabindex焦点放在ng repeat中的表元素上

Html 将tabindex焦点放在ng repeat中的表元素上,html,angularjs,Html,Angularjs,我有一个包含列表元素的表,我希望能够使用箭头键跳过这些元素。现在,我必须单击table元素边框,然后才能使用箭头键。如果我在循环中的一个元素上设置tabindex,它就不起作用。那么,在单击tabindex时,如何将其集中在table元素上呢 <section ng-controller="PlaylistCtrl" > <table class="table table-striped table-hover " ng-keyup="keyPress($eve

我有一个包含列表元素的表,我希望能够使用箭头键跳过这些元素。现在,我必须单击table元素边框,然后才能使用箭头键。如果我在循环中的一个元素上设置tabindex,它就不起作用。那么,在单击tabindex时,如何将其集中在table元素上呢

  <section ng-controller="PlaylistCtrl" >
      <table class="table table-striped table-hover " ng-keyup="keyPress($event.keyCode, $index)" tabindex="1">
        <thead>
          <tr>
            <th>
              <button  type="button" ng-click="toSubmit()"  class="btn btn-default">Add resource
              </button>
            </th>
          </tr>
        </thead>
        <tbody ui-sortable ng-model="result">
          <tr ng-repeat="resource in result">
            <td ng-class="isSelected(resource)">
              <div ng-click="showResource(resource, $index)">
                {{resource.name}}
              </div>
            </td>
            <td ng-class="isSelected(resource)" style="width: 15px;"><span class="glyphicon glyphicon-remove" id="sidebarEdit" ng-click="removeResource(resource, $index)"></span></td>
          </tr>
        </tbody>
      </table>
  </section>

添加资源
{{resource.name}

document.getElementById('table_id').focus()

我认为您必须自己关注元素。我使用指令做了类似的事情。请参阅以下答案: