更新AngularJS NG-模型只对关键preSS进入?只对、模型、关键、AngularJS

由网友(12级床震)分享简介:我有我使用一个搜索此输入字段:I have this input field I am using for a search:有我用很多其他的过滤器,以及(复选框,单选等),我有过...

我有我使用一个搜索此输入字段:

I have this input field I am using for a search:

<input id="search_input" type="text" ng-model="filter.search_terms">

有我用很多其他的过滤器,以及(复选框,单选等),我有过滤器$手表,任何改变都会触发一个搜索。问题是,我不希望搜索我每次键入一个字母,只希望它拯救它只有一次我preSS进入filter.search_terms时间火文本字段。

There are many other filters I use as well (checkboxes, radio, etc) and I have a $watch on filter so any changes will fire a search. The problem is that I don't want the search to fire for the text field every time I type a letter and only want it to "save" it on the filter.search_terms only once I press enter.

有没有一种简单的方法来做到这一点还是我不得不删除NG-模型,做一个NG点击?

Is there an easy way to do this or do I have to remove the ng-model and do an ng-click with a function that sets it on enter?

推荐答案

您可以尝试添加 NG-模式选项={updateOn:变模糊'}您输入标签。应工作。

You can try adding ng-model-options="{updateOn : 'change blur'}" to your input tag. Should work.

阅读全文

相关推荐

最新文章