ドロップダウン リストから値を選択し、angularJs の対応する選択 ID からデータを取得しようとしています
angular-ui/ui-selectディレクティブを思いついた
<ui-select ng-model="customer" theme="selectize">
<ui-select-match placeholder="Customer List">{{$select.selected.Name}}</ui-select-match>
<ui-select-choices repeat="customer in customers | filter: $select.search">
<span ng-bind-html="customer.Name | highlight: $select.search"></span>
<small ng-bind-html="customer.Id.toString() | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
私のコントローラーでは、顧客メソッドを取得しています
$scope.setActiveCustomer = function(customer) {
customersService.getCustomers(customer).then(function(response) {
$scope.selectedCustomer = response;
});
};
私の問題は
setActiveCustomer (onchange など) に使用するイベントを選択したら、顧客を選択します。アクティブ化を制御するために使用して
ng-click
いるため、何度も発生したイベントを使用すると。ng-click
他に、 ui-selectの初期値を設定するにはどうすればよいですか?
ありがとう