select-test.html – pleae see below image( I don’t know how to early paste html here.).
And there is a issue if you try below steps, please see below image.
step1: select class “TXC”;
step2: select class “ANV”;
It seems that switching between two lists whose length is 1 causes the issue, and I have no clue.
Is there anything related to data-binding system? Anyone knows why? : )
You can try to set a default student whenever selected class changes.
@observable private selectedClass = {};
selectedClassChanged(newClass) {
if (newClass && newClass.student && newClass.student.length) {
this.selectedStudent = newClass.student[0];
// you can also retain current selectedStudent value
// if the newClass includes current selectedStudent.
} else {
this.selectedStudent = '';
}
}
I add ‘characterData: true’ to line 148 in node_modules/aurelia-binding/src/select-value-observer.js. And run again, and the issue is still there. Please check it out. The key point is that there are two selects whose child select only has one item.
The src folder is for development, so you need to add it to either node_modules/aurelia-binding/dist/amd (requirejs / systemjs) or node_modules/aurelia-binding/dist/commonjsnode_modules/aurelia-binding/dist/native-modules (webpack)
Sorry, I am a newbie here and know not much about the aurelia framework structure.
I tried again and the issue is fixed. Thank you very much.
One more question, could I use this fix in production, or I use workaround instead right now?