0

我正在尝试使用预先输入的方式进行自动完成,以匹配精确的字符,例如 t 将匹配但不匹配 T。但我无法让它按我想要的方式工作。

曾尝试在 google 和 stackoverflow 中找到解决方案,例如: AngularJs UI typeahead match onleading characters AngularJS Filter Exact Match

这就是我的示例代码的样子: http ://plnkr.co/edit/mXthLrqNqpCyRYmj2qmT?p=preview

感谢您的帮助。

最好的问候,约翰尼

4

1 回答 1

4

你在找这个吗?看这里

实际上你是用小写比较的,因此它会在 't' 和 'T' 的情况下获取你的结果

 $scope.startsWith = function(state, viewValue) {
          return state.substr(0, viewValue.length) == viewValue;
        }

获取 T 的记录但不获取 t

于 2013-11-01T12:52:04.770 回答