[英]ui-select is not visible
我嘗試使用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>
知道有什么問題嗎?
您還必須使用ui-select-match指令。 否則將不會顯示。
<ui-select-match placeholder="do select..">
{{$select.selected.login}}
</ui-select-match>
您可以執行以下操作:
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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.