调用键盘搜索

2018-03-23  本文已影响0人  LIsPeri

<form action="#">
<input type="search" placeholder="输入关键字" ng-model="search.key" ng-focus="searchInput()"
ng-enter="doSearch(search.key)">
</form>
function ngEnter() { //删除搜索框的历史记录
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.apply(function(){ scope.eval(attrs.ngEnter);
});
event.preventDefault();
}
});
};
}

上一篇下一篇

猜你喜欢

热点阅读