我尝试使用ui-select而不是选择Angular应用。我的问题是ui-select不可见。
这是使用select:
的工作代码 <select class = "form-control"
ng-model = "vm.user">
<option ng:repeat = "u in vm.users"
value = "{{u.id}}">
{{u.login}}
</option>
</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
<!-- 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>
知道什么是错的吗?
答案 0 :(得分:1)
您还必须使用 ui-select-match 指令。否则不会显示。
<ui-select-match placeholder="do select..">
{{$select.selected.login}}
</ui-select-match>
答案 1 :(得分:0)
以下是您可以做的事情:
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>