Search code examples
javascriptangularjsangularjs-directiveui-select2angularjs-select2

Select2 directive callback when rendering done


I want to trigger a callback or event when my ui-select2 directive

<input
    type="hidden"
    ui-select2="myConstructorObject"
    ng-model="myModel"
    required />

has rendered the Select2 DOM elements. How can I achieve this? Is there any constructor atrribute I am not aware of?


Solution

  • FYI, I achieved it by adding a directive to the select2 element which listens to the select2-loaded event. This event is fired when the DOM object is completely initiated.