Javascript 如何限制“提前键入”选项从键盘选择?

Javascript 如何限制“提前键入”选项从键盘选择?,javascript,jquery,html,angularjs,typeahead.js,Javascript,Jquery,Html,Angularjs,Typeahead.js,我前面有一个输入类型,如下所示 <input typeahead-template-url="app/templates/type-a-head-item.html" type="text" ng-model="selectedDisease" search-head="powerSearch" typeahead-loading="loadingLocations" typeahead-wait-ms="200" typeahead-min-length="0

我前面有一个输入类型,如下所示

<input
  typeahead-template-url="app/templates/type-a-head-item.html"
  type="text"
  ng-model="selectedDisease"
  search-head="powerSearch"
  typeahead-loading="loadingLocations"
  typeahead-wait-ms="200"
  typeahead-min-length="0"
  placeholder="Disease, Procedure or Medicine"
  typeahead="match as match._source.name for match in getDiseases($viewValue)"
  typeahead-focus-first="false"
  typeahead-editable="false" 
  typeahead-loading="loadingDiseases"
  class="form-control input-lg ng-pristine ng-untouched ng-invalid ng-invalid-required magnifyInput Bcolor"
  typeahead-on-select="searchDoctors()"
  aria-autocomplete="list"
  aria-expanded="false"
  aria-owns="typeahead-12-6891">

添加此属性应可实现所需的行为:

typeahead-should-select="false"
从:

typeahead应选择($event)(默认值:null)

当可能触发选择的键控事件发生时执行的回调。 仅当此函数返回true时,才会进行选择


添加此属性应可实现所需的行为:

typeahead-should-select="false"
从:

typeahead应选择($event)(默认值:null)

当可能触发选择的键控事件发生时执行的回调。 仅当此函数返回true时,才会进行选择


“我尝试了很多方法”=>尝试分享。@mt1:您的问题解决了吗?如果您找到了解决方案,那么您可以与我们分享……:)'我尝试了很多方法'=>尝试共享。@mt1:您的问题解决了吗?如果您找到了解决方案,那么您可以与我们分享……:)嗨,marsze,我刚把typeahead放在前面,应该选择“false”,但不是working@mt1我自己也试过了,效果和预期的一样。定义“不工作”或澄清您想要的行为。实际上,我只是在输入中粘贴了“typeahead should select=“false”行,ddid没有做任何更改,但typeahead的行为没有更改。我还需要更改什么吗。@mt1阅读文档。我已经提供了链接。你应该明白你在做什么。这是我们不能为您做的。@mt1可能您的其他配置会以某种方式受到干扰。但我对它了解得还不够。根据文档,我的解决方案是正确的方法。但是你得自己试试。嗨,marsze,我刚把typeahead设置为应该选择=“false”,但不是working@mt1我自己也试过了,效果和预期的一样。定义“不工作”或澄清您想要的行为。实际上,我只是在输入中粘贴了“typeahead should select=“false”行,ddid没有做任何更改,但typeahead的行为没有更改。我还需要更改什么吗。@mt1阅读文档。我已经提供了链接。你应该明白你在做什么。这是我们不能为您做的。@mt1可能您的其他配置会以某种方式受到干扰。但我对它了解得还不够。根据文档,我的解决方案是正确的方法。但你得自己试试。