<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.eval(attrs.ngEnter);
});
event.preventDefault();
}
});
};
}
网友评论