Please provide an example with event handlers #39
Comments
The <div ng-dropdown-multiselect
options="regions_options"
selected-model="regions_selected"
events="{ onItemSelect: function(item) { console.log(item) } }"> Of course I’d advise against embedding the function’s body in the template. Instead you should define it in the controller and reference it by name in the template. |
Hi, I'm also new to this and this worked for me. $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> |
You can inline it like this <div ng-dropdown-multiselect
options="regions_options"
selected-model="regions_selected"
events="{ onItemSelect: someFunction }"> or even have multiple callbacks inline by extending the events object, like so: events="{ onItemSelect: someFunction, onInitDone: functionToBeExecutedOnInitDone }" Notice that we are referencing the function, not calling it. someFunction - without (). What I would like to know is how to get more data from the element. The onItemSelect callback provides the option's ID, nothing else. |
Using events is documented. Setting externalIdProp to "" will pass full items to events. (this should probably be documented) |
I've tried using onItemSelect event but it never gets called. Here are my options:
The text was updated successfully, but these errors were encountered: