I’m a bit new to Aurelia and am trying to learn the fundamentals of forms and data binding. I startedd looking into some examples like aurelia-ux, and noticed that a lot of the components do lots of dom operations and event handling within the viewmodel (.ts) file.
I was reading the docs though - and they generally seem to utilize the view engine to do stuff like keyup event binding and to use the for, if, etc helpers for rendering components. So my question is why does the aurelia-ux library do so much of this outside of the template and in the viewmodel?
for example in: https://github.com/aurelia/ux/blob/master/packages/form/src/ux-field.ts
if (this.label && !this.element.querySelector('label')) {
this.labelElement = document.createElement('label');
this.labelElement.classList.add('ux-field__label');
this.labelElement.textContent = this.label;
Thanks!