[英]ui-select is not visible
I try use ui-select instead select in Angular app. 我尝试使用ui-select代替在Angular应用中选择。 My problem is that ui-select is not visible.
我的问题是ui-select不可见。
This is working code with select: 这是带有select的工作代码:
<select class = "form-control"
ng-model = "vm.user">
<option ng:repeat = "u in vm.users"
value = "{{u.id}}">
{{u.login}}
</option>
</select>
not working code with ui-select ui-select无法正常工作
<ui-select ng-model = "vm.user"
style = "width: 300px; height: 50px">
<ui-select-choices repeat = "u in vm.users">
<div ng-bind-html = "u.login"></div>
</ui-select-choices>
</ui-select>
index.html index.html
<!-- UI-Select -->
<link href = "content/select.min.css"
rel = "stylesheet" />
<!-- Angular -->
<script src = "scripts/angular.min.js"></script>
<!-- UI-Select -->
<script src="scripts/select.min.js"></script>
Any idea what can be wrong? 知道有什么问题吗?
you have to use the ui-select-match directive as well. 您还必须使用ui-select-match指令。 otherwise it will not be displayed.
否则将不会显示。
<ui-select-match placeholder="do select..">
{{$select.selected.login}}
</ui-select-match>
Here is what you could do: 您可以执行以下操作:
angular.module('something', ['ui.select'])
<ui-select ng-model="vm.user" style="width: 300px; height: 50px;">
<ui-select-match placeholder="Select user...">
{{$select.selected.name}}
</ui-select-match>
<ui-select-choices repeat="user in vm.users | filter: $select.search">
<div ng-bind-html="user.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
https://github.com/angular-ui/ui-select/issues/1731 https://github.com/angular-ui/ui-select/issues/1731
https://github.com/angular-ui/ui-select/issues/1652 https://github.com/angular-ui/ui-select/issues/1652
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.