按键操作

  1. 按键不操作0.5秒后执行某个函数:
    <input class="form-control" ng-model="$ctrl.data.keyword" placeholder="please input site.."
                           style="border-right: 0;"
                           ng-change="$ctrl.searchSite()" ng-model-options="{debounce: 500}"/>
  2. 回车按键搜索:
    ng-keyup="$ctrl.keySearch($event)"

    $scope.keySearch = function (e) { var keycode = window.event ? e.keyCode : e.which; if (keycode == 13) { $scope.search(data.keyword); } };
  3. 上下键来回切换列表选择:

原文地址:https://www.cnblogs.com/maoyazhi/p/7050524.html