我在ui-select中遇到以下问题:
请参阅this plunk。
<form>
<div ng-repeat="e in entries">
<div class="form-group">
<div class="col-xs-8">
<ui-select ng-model="e.$account" >
<ui-select-match>{{ $select.selected.code }}</ui-select-match>
<ui-select-choices repeat="acct in accounts | filter: $select.search">
<span ng-bind-html="(acct.code + ' - ' + acct.name)
| highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
<div class="col-xs-4">
<input type="text" class="form-control text-right" ng-model="e.amount"/>
</div>
</div>
</div>
</form>
angular.module('demo', ['ui.select'])
.controller('DemoCtrl', ['$scope', '$location', '$timeout',
function ($scope, $location, $timeout) {
$scope.accounts = [
{code: '100', name: 'Cash'},
{code: '200', name: 'Accounts receivable'},
{code: '300', name: 'Inventory'}
];
$scope.entries = [
{'$account': $scope.accounts[0], amount: 500},
{'$account': $scope.accounts[2], amount: 920}
];
}]);