So I\'m trying to use Select2 within my Aurelia application. I installed Select2 using jspm install select2, and within my app.html file I require
For the sake of completion, firing the change event in Jeremy's solution results in a recursive loop and causes exception to fix it I had to do:
attached() {
$(this.element)
.select2(this.value)
.on('change', evt => {
if (evt.originalEvent) { return; }
this.element.dispatchEvent(new Event('change'));
});
}
I could then do:
changeCallback($event) can be a function on your vm e.g.
changeCallback(evt: Event): void {
console.log(evt);
}