如何在AngularJS Dropdown Multiselect中使用onItemSelect和onItemDeselect两个事件

时间:2015-12-07 13:32:02

标签: angularjs angularjs-directive

我正在使用AngularJS Dropdown Multiselect。 http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

我想要同时使用这两个事件。但不知道如何配置两者。我只能成功配置其中一个。

onItemSelect(property)

onItemDeselect(property)

HTML

<div ng-dropdown-multiselect="" options="property.dropdowns" selected-model="property.propertyValues"
                            extra-settings="multiSelectDropdownSettingsMaxOne" ng-required="property.startDate != null" events="onItemSelect(property)"></div>

更新

我尝试使用逗号分隔符,但出现错误

<div ng-dropdown-multiselect="" options="property.dropdowns" selected-model="property.propertyValues" extra-settings="multiSelectDropdownSettingsMaxOne" ng-required="property.startDate != null" events="onItemSelect(property), onItemDeSelect(property)"></div>

1 个答案:

答案 0 :(得分:10)

试试这个:

$scope.yourEvents = {onInitDone: function(item) {console.log(item);},onItemDeselect: function(item) {console.log(item);}};

<div ng-dropdown-multiselect="" options="YourData" events="yourEvents" 
 selected-model="YourModel" extra-settings="yourSettings">
</div>

[source]