im using angularjs with select2 for application dropdowns, but i cannot figure how to get the change event or some other, inside my Controller.
is there some way to declare the eventhandler function via attribute?, like ui-select2 data-on-somethinghappened="fnx"?
or instead on my configuration? like:
appXpto.value('ui.config', {
select2: {
placeholder: 'Please select a value..',
onsomethinghappened:function(e){ ... }
}
});
thanks in advance
yes, you can bind controller functions to directive scope object and call them when a select2 event happens on the directive. Use & to bind the function. then call scope.myBoundFunction() to call that function with or without parameters.