2016-10-28 6 views

答えて

2

あなたはAngularJSでjQueryプラグインを使用している、あなたは、以下に示すように要素にバインドさディレクティブ内の関数を呼び出すことによって、それを使用することができます。

HTML:

<select class="selectpicker" bootstrap-selectpicker data-ng-model="modelValue" multiple="" data-actions-box="true"> 
<option>Mustard</option> 
<option>Ketchup</option> 
<option>Relish</option> 
</select> 

指令:

app.directive('bootstrapSelectpicker'), function(){ 
var bootDirective = { 
    restrict : 'A', 
    link: function(scope, element, attr){ 
     $(element).selectpicker(); 
    }   
}; 
    return bootDirective; 
}); 

しかし、Angularjsベースのdropwdownsを使用することをお勧めします、次のプラグインを見てみましょう。 http://angular-ui.github.io/ui-select/

このことができます

http://ngmodules.org/modules/angular-bootstrap-multiselect https://github.com/dotansimha/angularjs-dropdown-multiselect

希望:)私はoptionタグにng-repeatと協力

+0

ありがとうございました! – Patres

関連する問題