Angular bootstrap uib-typeahead
Angular bootstrap uib-typeahead
如何仅从 HTML 视图将 uib-typeahed
结果设置为大写。
我不关心控制器的任何结果,但在视图中它应该是大写的。
此外,uppercase
过滤器无法正常工作。
这里是attached plunker。
帮帮我,
谢谢。
请检查这个plunker
您需要为此使用自定义模板 typeahead-template-url="customTemplate.html"
并像这样添加新的自定义模板。
<a>
<span ng-bind-html="match.label |uppercase"></span>
</a>
Ashish 提供的答案很好,但如果您想使 UI 一致,您可以 refer this approach
<input type="text" ng-model="selected"
uib-typeahead="state.toUpperCase() for state in states | filter:$viewValue | limitTo:8"
class="form-control">
这样在输入框
里面选择的值也是大写的
您只需在案例中添加 css 即可使视图中的结果大写
.typeahead-demo .dropdown-menu {
text-transform : uppercase;
}
笨蛋:https://plnkr.co/edit/Ni719u1pNCOVMiMfLQeL?p=preview
注意:已从您的输入元素中删除了大写字母,因为那将不起作用。
如何仅从 HTML 视图将 uib-typeahed
结果设置为大写。
我不关心控制器的任何结果,但在视图中它应该是大写的。
此外,uppercase
过滤器无法正常工作。
这里是attached plunker。
帮帮我, 谢谢。
请检查这个plunker
您需要为此使用自定义模板 typeahead-template-url="customTemplate.html"
并像这样添加新的自定义模板。
<a>
<span ng-bind-html="match.label |uppercase"></span>
</a>
Ashish 提供的答案很好,但如果您想使 UI 一致,您可以 refer this approach
<input type="text" ng-model="selected"
uib-typeahead="state.toUpperCase() for state in states | filter:$viewValue | limitTo:8"
class="form-control">
这样在输入框
里面选择的值也是大写的您只需在案例中添加 css 即可使视图中的结果大写
.typeahead-demo .dropdown-menu {
text-transform : uppercase;
}
笨蛋:https://plnkr.co/edit/Ni719u1pNCOVMiMfLQeL?p=preview
注意:已从您的输入元素中删除了大写字母,因为那将不起作用。