Angular UI bootstrap typeahead select 当只有一个匹配时
Angular UI bootstrap typeahead select when there is only one match
是否可以配置(内置或通过自定义指令)Angular UI bootstrap typeahead 以便它 select 值只有一场比赛?有 typeahead-select-on-exact 选项,但要使其起作用,输入的值必须与 typeahead
的完整选项匹配
请参阅下面的 plunker。我已经添加了 typeahead-select-on-exact,因此当您键入 "Portugal" 时,它 select 就是值。
我想要实现的行为是当您键入 "Portu" 时,提前键入 selects 葡萄牙(因为这是唯一可能的匹配项)。
<input type="text" typeahead-select-on-exact="true">
对于我的用例,我最终将以下内容添加到 getLocation() 方法(参见问题中的 plunker 示例)
if(response.data.length === 1) {
$scope.asyncSelected = response.data[0].name
}
是否可以配置(内置或通过自定义指令)Angular UI bootstrap typeahead 以便它 select 值只有一场比赛?有 typeahead-select-on-exact 选项,但要使其起作用,输入的值必须与 typeahead
的完整选项匹配请参阅下面的 plunker。我已经添加了 typeahead-select-on-exact,因此当您键入 "Portugal" 时,它 select 就是值。 我想要实现的行为是当您键入 "Portu" 时,提前键入 selects 葡萄牙(因为这是唯一可能的匹配项)。
<input type="text" typeahead-select-on-exact="true">
对于我的用例,我最终将以下内容添加到 getLocation() 方法(参见问题中的 plunker 示例)
if(response.data.length === 1) {
$scope.asyncSelected = response.data[0].name
}